CREATE SCHEMA Tramway;
SET search_path TO Tramway, public;
CREATE TABLE Tramway.Horaires (
  Ligne char(1) NOT NULL, 
  Depart text NOT NULL, 
  Heure_Depart time NOT NULL, 
  Bassens time DEFAULT NULL, 
  Bassins_a_Flot time DEFAULT NULL, 
  Begles time DEFAULT NULL, 
  Buttiniere time DEFAULT NULL, 
  Claveau time DEFAULT NULL, 
  Floirac time DEFAULT NULL, 
  Hotel_De_Ville time DEFAULT NULL, 
  Les_Aubiers time DEFAULT NULL, 
  Merignac time DEFAULT NULL, 
  Pessac time DEFAULT NULL, 
  Porte_Bourgogne time DEFAULT NULL, 
  Quinconces time DEFAULT NULL, 
  PRIMARY KEY (Ligne, Depart, Heure_Depart)
);
CREATE TABLE Tramway.Troncons (
  Ligne Char(1) NOT NULL,
  Station1 text NOT NULL,
  Station2 text NOT NULL,
  Duree interval NOT NULL, -- interval : type compatible avec le type time
  PRIMARY KEY (Station1, Station2)
);
CREATE TABLE Tramway.Trains (
  Ligne Char(1) NOT NULL,
  Depart text NOT NULL,
  Heure_Depart time NOT NULL,
  Arrivee text NOT NULL,
  PRIMARY KEY (Ligne, Depart, Heure_Depart)
);
