CREATE TABLE tx_trajet_partage (id INT AUTO_INCREMENT NOT NULL, tx_zone_id_depart INT DEFAULT NULL, tx_zone_id_arrive INT DEFAULT NULL, tx_vehicule_id INT DEFAULT NULL, trj_name VARCHAR(100) DEFAULT NULL, trj_date DATE DEFAULT NULL, trj_heure_depart TIME DEFAULT NULL, trj_heure_arrivee TIME DEFAULT NULL, trj_prix_place DOUBLE PRECISION DEFAULT NULL, INDEX IDX_80A9F525CA1337AF (tx_zone_id_depart), INDEX IDX_80A9F525E2D8914B (tx_zone_id_arrive), INDEX IDX_80A9F525ADADABF0 (tx_vehicule_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;
ALTER TABLE tx_trajet_partage ADD CONSTRAINT FK_80A9F525CA1337AF FOREIGN KEY (tx_zone_id_depart) REFERENCES tx_zone (id) ON DELETE CASCADE;
ALTER TABLE tx_trajet_partage ADD CONSTRAINT FK_80A9F525E2D8914B FOREIGN KEY (tx_zone_id_arrive) REFERENCES tx_zone (id) ON DELETE CASCADE;
ALTER TABLE tx_trajet_partage ADD CONSTRAINT FK_80A9F525ADADABF0 FOREIGN KEY (tx_vehicule_id) REFERENCES tx_vehicule (id) ON DELETE CASCADE;
ALTER TABLE tx_reservation ADD tx_trj_partage_id INT DEFAULT NULL;
ALTER TABLE tx_reservation ADD CONSTRAINT FK_A52FD7B49E3E55F9 FOREIGN KEY (tx_trj_partage_id) REFERENCES tx_trajet_partage (id) ON DELETE SET NULL;
CREATE INDEX IDX_A52FD7B49E3E55F9 ON tx_reservation (tx_trj_partage_id);
