CREATE TABLE  `day_planning` (
  `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `DAY_TYPE_ID` int(5) NOT NULL DEFAULT '0',
  `USER_ID` int(10) unsigned DEFAULT '0',
  `DAY` date NOT NULL DEFAULT '0000-00-00',
  `BEGIN_HOUR` int(4) NOT NULL DEFAULT '0',
  `END_HOUR` int(4) NOT NULL DEFAULT '0',
  `LENGTH` int(4) NOT NULL DEFAULT '0',
  `TYPE` tinyint(4) DEFAULT '0',
  `COMM` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB CHARSET=latin1;

CREATE TABLE  `driver_planning` (
  `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `DAY_PLANNING_ID` int(10) unsigned NOT NULL DEFAULT '0',
  `DRIVER_ID` int(5) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  CONSTRAINT `dp_day_planning` FOREIGN KEY (`DAY_PLANNING_ID`) REFERENCES `day_planning` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `dp_driver` FOREIGN KEY (`DRIVER_ID`) REFERENCES `t_conducteur` (`CLE_CHAUFFEUR`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE  `vehicle_planning` (
  `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `DAY_PLANNING_ID` int(10) unsigned NOT NULL DEFAULT '0',
  `VEHICLE_ID` int(5) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  CONSTRAINT `dp_dayv_planning` FOREIGN KEY (`DAY_PLANNING_ID`) REFERENCES `day_planning` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `dp_vehicle` FOREIGN KEY (`VEHICLE_ID`) REFERENCES `t_vehicule` (`CLE_VEHICULE`) ON DELETE CASCADE
) ENGINE=InnoDB CHARSET=latin1;

alter table t_lien_jour_conducteur add column COMM varchar(64) DEFAULT NULL;