ALTER TABLE `optional_subject` 
ADD COLUMN `project_osb` ENUM('YES', 'NO') NOT NULL DEFAULT 'NO' AFTER `has_options`;

ALTER TABLE `subject_course` 
ADD COLUMN `project_sbc` ENUM('YES', 'NO') NOT NULL DEFAULT 'NO' AFTER `has_options`;


CREATE TABLE `option_subject_ops` (
  `serial_ops` INT NOT NULL AUTO_INCREMENT,
  `serial_osb` INT NULL,
  `serial_sbc` INT NULL,
  `oral_grade` BOOLEAN NOT NULL DEFAULT 0,
  `theme` BOOLEAN NOT NULL DEFAULT 0,
  `comment` BOOLEAN NOT NULL DEFAULT 0,
  `status` ENUM('ACTIVE', 'INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  INDEX `fk_ops_osb_idx` (`serial_osb` ASC),
  INDEX `fk_ops_sbc_idx` (`serial_sbc` ASC),
  PRIMARY KEY (`serial_ops`),
  CONSTRAINT `fk_ops_osb`
    FOREIGN KEY (`serial_osb`)
    REFERENCES `optional_subject` (`serial_osb`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_ops_sbc`
    FOREIGN KEY (`serial_sbc`)
    REFERENCES `subject_course` (`serial_sbc`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION);

ALTER TABLE `student_period_exam` 
ADD COLUMN `oral_grade_project` DECIMAL(8,5) NULL AFTER `observations`,
ADD COLUMN `theme_project` TEXT NULL AFTER `oral_grade_project`;


ALTER TABLE `period` 
ADD COLUMN `alternative_name_prd` VARCHAR(100) NULL AFTER `exam_grade_allowed`;

UPDATE `period` SET `alternative_name_prd`='AVANCE' WHERE `serial_prd`='1';
UPDATE `period` SET `alternative_name_prd`='FINAL' WHERE `serial_prd`='2';
ALTER TABLE `school_year` 
ADD COLUMN `project_allowed_scy` ENUM('YES', 'NO') NOT NULL DEFAULT 'NO' AFTER `use_new_activities_calculus_scy`;


