
-- categorias de BI (NS/NM)
CREATE TABLE `level_international_baccalaureate` (
  `serial_lib` INT NOT NULL AUTO_INCREMENT,
  `name_lib` VARCHAR(45) NOT NULL,
  `description_lib` VARCHAR(45) NOT NULL,
  `status_lib` ENUM('ACTIVE', 'INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_lib`));

CREATE TABLE `category_language_baccalaureate` (
  `serial_clb` INT NOT NULL AUTO_INCREMENT,
  `serial_lng` INT NOT NULL,
  `serial_lib` INT NOT NULL,
  `status_clb` ENUM('ACTIVE', 'INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_clb`));

ALTER TABLE `category_language_baccalaureate`
ADD INDEX `fk_lng_idx` (`serial_lng` ASC),
ADD INDEX `fk_lib_idx` (`serial_lib` ASC);
ALTER TABLE `category_language_baccalaureate`
ADD CONSTRAINT `fk_lng`
  FOREIGN KEY (`serial_lng`)
  REFERENCES `language` (`serial_lng`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_lib`
  FOREIGN KEY (`serial_lib`)
  REFERENCES `level_international_baccalaureate` (`serial_lib`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

-- agrego campo en student_optional_subject
ALTER TABLE `student_optional_subject`
ADD COLUMN `serial_lib` INT(11) NULL DEFAULT NULL AFTER `serial_lop`;
