-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `final_exams_change_log`
--

CREATE TABLE IF NOT EXISTS `final_exams_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_sya` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `serial_spt` int(11) DEFAULT NULL,
  `serial_lvl` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_set` int(11) DEFAULT NULL,
  `type_fecl` enum('RESIT','REMEDY','GRACE') DEFAULT 'RESIT',
  `change_date_fecl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_fecl` decimal(8,5) NOT NULL,
  `comment_fecl` text,
  KEY `fk_relationship_serials_avg_year` (`serial_sya`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_user_log_fem` (`serial_usr`),
  KEY `fk_relationship_clog_avg_year` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Filtros para la tabla `final_exams_change_log`
--
ALTER TABLE `final_exams_change_log`
  ADD CONSTRAINT `fk_relationship_serials_avg_year` FOREIGN KEY (`serial_sya`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_subject_year_average` (`serial_sya`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_user_log_fem` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_clog_avg_year` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`);
