CREATE TABLE `list_guardian` (
  `serial_lsg` INT NOT NULL AUTO_INCREMENT,
  `name_lsg` VARCHAR(45) NULL,
  `alias_lsg` VARCHAR(45) NULL,
  `status_lsg` ENUM('ACTIVE', 'INACTIVE') NULL,
  PRIMARY KEY (`serial_lsg`));

  
  CREATE TABLE `list_guardian_school_year` (
  `serial_lgs` INT NOT NULL AUTO_INCREMENT,
  `serial_lsg` INT NULL,
  `serial_grd` INT NULL,
  `serial_scy` INT NULL,
  `serial_usr` INT NULL,
  `acept_lgs` ENUM('YES', 'NO') NULL,
  `ip_address_lsy` VARCHAR(45) NULL,
  `date_create_lgs` DATETIME NULL,
  `date_update_lgs` DATETIME NULL,
  `status_lsy` ENUM('ACTIVE', 'INACTIVE') NULL,
  PRIMARY KEY (`serial_lgs`));

  
  ALTER TABLE `list_guardian_school_year` 
ADD INDEX `fk_lsy_lsg_idx` (`serial_lsg` ASC),
ADD INDEX `fk_lgs_grd_idx` (`serial_grd` ASC),
ADD INDEX `fk_lgs_scy_idx` (`serial_scy` ASC),
ADD INDEX `fk_lgs_usr_idx` (`serial_usr` ASC);
ALTER TABLE `list_guardian_school_year` 
ADD CONSTRAINT `fk_lgs_lsg`
  FOREIGN KEY (`serial_lsg`)
  REFERENCES `list_guardian` (`serial_lsg`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_lgs_grd`
  FOREIGN KEY (`serial_grd`)
  REFERENCES `guardian` (`serial_grd`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_lgs_scy`
  FOREIGN KEY (`serial_scy`)
  REFERENCES `school_year` (`serial_scy`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_lgs_usr`
  FOREIGN KEY (`serial_usr`)
  REFERENCES `user` (`serial_usr`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;
  
  INSERT INTO `list_guardian` (`name_lsg`, `alias_lsg`, `status_lsg`) VALUES ('ACEPTA CÓDIGO DE CONDUCTA', 'ACEPT_CONDUCT_CODE', 'ACTIVE');

ALTER TABLE `list_guardian` 
ADD COLUMN `document_link_1` TEXT NULL AFTER `status_lsg`,
ADD COLUMN `document_link_2` TEXT NULL AFTER `document_link_1`;

UPDATE `list_guardian` SET `document_link_1`='http://192.168.56.10/RUTADEMIC/DEV/laravel/public/pdf/codigoconductafamilias.pdf', `document_link_2`='http://192.168.56.10/RUTADEMIC/DEV/laravel/public/pdf/codigoconductaestudiantes.pdf' WHERE `serial_lsg`='1';
UPDATE `list_guardian` SET `alias_lsg`='ACCEPT_CONDUCT_CODE' WHERE `serial_lsg`='1';

INSERT INTO `process` (`serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('701', 'Código de conducta', 'laravel/public/concuctCode/index', '1.00', 'LOCKABLE');
UPDATE `process` SET `link_prc`='#' WHERE `serial_prc`='701';
INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('712', '701', 'Iniciar', 'laravel/public/concuctCode/index', '1.00', 'LOCKABLE');
insert into allowed_pages_by_process values('712','conductcodecontroller@getindex');
insert into allowed_pages_by_process values('712','conductcodecontroller@postsave');

INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('703', '701', 'Reporte', 'laravel/public/concuctCode/index-report', '1.00', 'LOCKABLE');
insert into allowed_pages_by_process values('712','conductcodecontroller@getindexreport');
insert into allowed_pages_by_process values('712','conductcodecontroller@postreport');