--
-- Estructura de tabla para la tabla `subperiod_discipline_change_log`
--

CREATE TABLE IF NOT EXISTS `subperiod_discipline_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_cdd` int(11) DEFAULT NULL,
  `serial_sdg` int(11) DEFAULT NULL,
  `serial_sds` int(11) DEFAULT NULL,
  `change_date_sdcl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_sdcl` decimal(8,5) NOT NULL,
  `comment_sdcl` text,  
  KEY `fk_relationship_serial_usr_sdcl` (`serial_usr`),
  KEY `fk_relationship_serial_cdd_sdcl` (`serial_cdd`),
  KEY `fk_relationship_serial_sdg_sdcl` (`serial_sdg`),
  KEY `fk_relationship_serial_sds_sdcl` (`serial_sds`),  
  KEY `fk_relationship_serial_chr_sdcl` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Relaciones para la tabla `subperiod_discipline_change_log`
--
ALTER TABLE `subperiod_discipline_change_log`
  ADD CONSTRAINT `fk_relationship_serial_usr_sdcl` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_serial_cdd_sdcl` FOREIGN KEY (`serial_cdd`) REFERENCES `student_subperiod_discipline_course_director` (`serial_cdd`),
  ADD CONSTRAINT `fk_relationship_serial_sdg_sdcl` FOREIGN KEY (`serial_sdg`) REFERENCES `student_subperiod_discipline_subject` (`serial_sdg`),
  ADD CONSTRAINT `fk_relationship_serial_sds_sdcl` FOREIGN KEY (`serial_sds`) REFERENCES `student_subperiod_discipline_supervisor` (`serial_sds`),  
  ADD CONSTRAINT `fk_relationship_serial_chr_sdcl` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`);
