﻿-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 31-03-2011 a las 23:15:50
-- Versión del servidor: 5.1.41
-- Versión de PHP: 5.3.1

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Base de datos: `RUTADEMIC`
--

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

--
-- Estructura de tabla para la tabla `academic_area`
--

CREATE TABLE IF NOT EXISTS `academic_area` (
  `serial_aca` int(11) NOT NULL AUTO_INCREMENT,
  `name_aca` varchar(150) NOT NULL,
  `description_aca` text NOT NULL,
  `status_aca` enum('ACTIVE','INACTIVE') NOT NULL,
  PRIMARY KEY (`serial_aca`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `access_log`
--

CREATE TABLE IF NOT EXISTS `access_log` (
  `serial_alg` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_prf` int(11) DEFAULT NULL,
  `login_date_alg` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`serial_alg`),
  KEY `fk_relationship_143` (`serial_usr`,`serial_prf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `activity`
--

CREATE TABLE IF NOT EXISTS `activity` (
  `serial_act` int(11) NOT NULL AUTO_INCREMENT,
  `name_act` varchar(256) NOT NULL,
  `description_act` text NOT NULL,
  `send_date_act` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `due_date_act` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status_act` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_act`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `activity_applied_criterias`
--

CREATE TABLE IF NOT EXISTS `activity_applied_criterias` (
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `serial_sbc` int(11) NOT NULL,
  `serial_sbj` int(11) NOT NULL,
  `serial_gct` int(11) NOT NULL,
  `serial_act` int(11) NOT NULL,
  `weight_aac` decimal(5,2) NOT NULL,
  `status_aac` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_att`,`serial_prd`,`serial_sbc`,`serial_gct`,`serial_act`),
  KEY `fk_activity_header` (`serial_act`),
  KEY `fk_relationship_95` (`serial_att`,`serial_prd`,`serial_sbc`,`serial_sbj`,`serial_gct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `activity_attachment`
--

CREATE TABLE IF NOT EXISTS `activity_attachment` (
  `serial_ath` int(11) NOT NULL AUTO_INCREMENT,
  `serial_act` int(11) DEFAULT NULL,
  `name_ath` varchar(256) NOT NULL,
  `filename_ath` varchar(256) NOT NULL,
  `status_ath` enum('ACTIVE','INACTIVE','DELETED') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ath`),
  KEY `fk_relationship_96` (`serial_act`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `activity_policy_violations`
--

CREATE TABLE IF NOT EXISTS `activity_policy_violations` (
  `serial_opa` int(11) DEFAULT NULL,
  `serial_act` int(11) DEFAULT NULL,
  `serial_emp` int(11) DEFAULT NULL,
  `start_date_apv` date NOT NULL,
  `end_date_apv` date NOT NULL,
  KEY `fk_relationship_146` (`serial_act`),
  KEY `fk_relationship_147` (`serial_opa`),
  KEY `fk_relationship_148` (`serial_emp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `activity_type`
--

CREATE TABLE IF NOT EXISTS `activity_type` (
  `serial_att` int(11) NOT NULL AUTO_INCREMENT,
  `name_att` varchar(256) NOT NULL,
  `description_att` text NOT NULL,
  `status_att` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_att`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `allowed_pages_by_process`
--

CREATE TABLE IF NOT EXISTS `allowed_pages_by_process` (
  `serial_prc` int(11) DEFAULT NULL,
  `url_dsc` varchar(1024) NOT NULL,
  KEY `fk_child_pages` (`serial_prc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `article`
--

CREATE TABLE IF NOT EXISTS `article` (
  `serial_art` int(11) NOT NULL AUTO_INCREMENT,
  `code_art` varchar(10) NOT NULL,
  `name_art` varchar(250) NOT NULL,
  `stock_art` int(11) NOT NULL,
  `status_art` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_art`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `attendance`
--

CREATE TABLE IF NOT EXISTS `attendance` (
  `serial_ace` int(11) NOT NULL AUTO_INCREMENT,
  `serial_std` int(11) DEFAULT NULL,
  `serial_scd` int(11) DEFAULT NULL,
  `date_ace` date NOT NULL,
  `type_ace` enum('UNEXCUSED_ABSENCE','EXCUSED_ABSENCE','DELAY') NOT NULL,
  `status_ace` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ace`),
  KEY `fk_relationship_289` (`serial_scd`),
  KEY `fk_relationship_290` (`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `author`
--

CREATE TABLE IF NOT EXISTS `author` (
  `serial_atr` int(11) NOT NULL AUTO_INCREMENT,
  `code_atr` varchar(20) NOT NULL,
  `name_atr` varchar(512) NOT NULL,
  `status_atr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_atr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `authority`
--

CREATE TABLE IF NOT EXISTS `authority` (
  `serial_aut` int(11) NOT NULL AUTO_INCREMENT,
  `serial_atc` int(11) DEFAULT NULL,
  `id_aut` varchar(15) NOT NULL,
  `degree_aut` varchar(50) NOT NULL,
  `first_name_aut` varchar(100) NOT NULL,
  `last_name_aut` varchar(100) NOT NULL,
  `in_charge_aut` enum('YES','NO') NOT NULL,
  PRIMARY KEY (`serial_aut`),
  KEY `fk_has_charge` (`serial_atc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `authority_charge`
--

CREATE TABLE IF NOT EXISTS `authority_charge` (
  `serial_atc` int(11) NOT NULL AUTO_INCREMENT,
  `name_atc` varchar(100) NOT NULL,
  `description_atc` text,
  `status_atc` enum('ACTIVE','INACTIVE') NOT NULL,
  PRIMARY KEY (`serial_atc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `book`
--

CREATE TABLE IF NOT EXISTS `book` (
  `serial_bok` int(11) NOT NULL AUTO_INCREMENT,
  `serial_bct` int(11) DEFAULT NULL,
  `serial_lst` int(11) DEFAULT NULL,
  `classification_number_bok` varchar(15) DEFAULT NULL,
  `title_bok` varchar(1024) NOT NULL,
  `editorial_bok` varchar(256) DEFAULT NULL,
  `pages_bok` int(11) DEFAULT NULL,
  `publication_year_bok` int(11) DEFAULT NULL,
  `publication_place_bok` varchar(256) DEFAULT NULL,
  `volume_bok` int(11) DEFAULT NULL,
  PRIMARY KEY (`serial_bok`),
  KEY `fk_relationship_271` (`serial_bct`),
  KEY `fk_relationship_272` (`serial_lst`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `book_author`
--

CREATE TABLE IF NOT EXISTS `book_author` (
  `serial_atr` int(11) DEFAULT NULL,
  `serial_bok` int(11) DEFAULT NULL,
  `status_bka` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_273` (`serial_atr`),
  KEY `fk_relationship_274` (`serial_bok`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `book_category`
--

CREATE TABLE IF NOT EXISTS `book_category` (
  `serial_bct` int(11) NOT NULL AUTO_INCREMENT,
  `boo_serial_bct` int(11) DEFAULT NULL,
  `name_bct` varchar(256) NOT NULL,
  `status_bct` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_bct`),
  KEY `fk_relationship_270` (`boo_serial_bct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `book_copy`
--

CREATE TABLE IF NOT EXISTS `book_copy` (
  `serial_bkc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_bok` int(11) DEFAULT NULL,
  `copy_number_bkc` int(11) NOT NULL,
  `available_bkc` enum('YES','NO') NOT NULL DEFAULT 'YES',
  `partial_damage_value_bkc` decimal(10,0) DEFAULT NULL,
  `total_damage_value_bkc` decimal(10,0) DEFAULT NULL,
  `status_bkc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_bkc`),
  KEY `fk_relationship_275` (`serial_bok`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `bus`
--

CREATE TABLE IF NOT EXISTS `bus` (
  `serial_bus` int(11) NOT NULL AUTO_INCREMENT,
  `code_bus` varchar(13) NOT NULL,
  `plate_num_bus` varchar(12) NOT NULL,
  `description_bus` text NOT NULL,
  `capacity_bus` int(11) NOT NULL,
  `status_bus` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_bus`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `bus_driver`
--

CREATE TABLE IF NOT EXISTS `bus_driver` (
  `serial_bdr` int(11) NOT NULL AUTO_INCREMENT,
  `id_bdr` varchar(13) NOT NULL,
  `first_name_bdr` varchar(512) NOT NULL,
  `last_name_bdr` varchar(512) NOT NULL,
  `mobile1_bdr` varchar(30) DEFAULT NULL,
  `mobile2_bdr` varchar(30) DEFAULT NULL,
  `phone1_bdr` varchar(30) NOT NULL,
  `phone2_bdr` varchar(30) DEFAULT NULL,
  `phone3_bdr` varchar(30) DEFAULT NULL,
  `address_bdr` text NOT NULL,
  `drive_license_bdr` varchar(20) NOT NULL,
  `license_expire_date_bdr` date NOT NULL,
  `status_bdr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_bdr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `bus_shift_year`
--

CREATE TABLE IF NOT EXISTS `bus_shift_year` (
  `serial_bdr` int(11) NOT NULL,
  `serial_rot` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_bus` int(11) NOT NULL,
  `serial_sft` int(11) NOT NULL,
  `bus_serial_bdr` int(11) DEFAULT NULL,
  `status_bpy` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_rot`,`serial_scy`,`serial_bus`,`serial_sft`),
  KEY `fk_relationship_76` (`serial_scy`),
  KEY `fk_relationship_77` (`serial_bdr`),
  KEY `fk_relationship_78` (`serial_bus`),
  KEY `fk_relationship_80` (`serial_sft`),
  KEY `fk_relationship_81` (`bus_serial_bdr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `bus_year_user`
--

CREATE TABLE IF NOT EXISTS `bus_year_user` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_rot` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_bus` int(11) DEFAULT NULL,
  `serial_sft` int(11) DEFAULT NULL,
  `status_byu` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_97` (`serial_rot`,`serial_scy`,`serial_bus`,`serial_sft`),
  KEY `fk_relationship_98` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `cat_period`
--

CREATE TABLE IF NOT EXISTS `cat_period` (
  `serial_cpd` int(11) NOT NULL AUTO_INCREMENT,
  `name_cpd` varchar(100) NOT NULL,
  `description_cpd` text,
  `status_cpd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_cpd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `cat_subject`
--

CREATE TABLE IF NOT EXISTS `cat_subject` (
  `serial_csb` int(11) NOT NULL AUTO_INCREMENT,
  `cat_serial_csb` int(11) DEFAULT NULL,
  `serial_aca` int(11) DEFAULT NULL,
  `serial_lng` int(11) DEFAULT NULL,
  `code_csb` varchar(20) NOT NULL,
  `name_csb` varchar(255) NOT NULL,
  `status_csb` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_csb`),
  KEY `fk_child_parent` (`cat_serial_csb`),
  KEY `fk_relationship_62` (`serial_aca`),
  KEY `fk_relationship_68` (`serial_lng`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `change_reason`
--

CREATE TABLE IF NOT EXISTS `change_reason` (
  `serial_chr` int(11) NOT NULL AUTO_INCREMENT,
  `name_chr` varchar(256) NOT NULL,
  `type_chr` enum('DISCIPLINE','ACTIVITY','BOTH') NOT NULL DEFAULT 'BOTH',
  `status_chr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `classroom`
--

CREATE TABLE IF NOT EXISTS `classroom` (
  `serial_clr` int(11) NOT NULL AUTO_INCREMENT,
  `name_clr` varchar(80) NOT NULL,
  `capacity_clr` int(11) NOT NULL,
  `description_clr` text NOT NULL,
  `status_clr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_clr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `class_group`
--

CREATE TABLE IF NOT EXISTS `class_group` (
  `serial_clg` int(11) NOT NULL AUTO_INCREMENT,
  `name_clg` varchar(150) NOT NULL,
  `description_clg` text,
  `status_clg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_clg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `country`
--

CREATE TABLE IF NOT EXISTS `country` (
  `serial_cou` int(11) NOT NULL AUTO_INCREMENT,
  `name_cou` varchar(100) DEFAULT NULL,
  `status_cou` enum('ACTIVE','INACTIVE') DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_cou`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `course`
--

CREATE TABLE IF NOT EXISTS `course` (
  `serial_crs` int(11) NOT NULL AUTO_INCREMENT,
  `serial_clg` 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,
  `attendance_crs` enum('DAY','CLASS') NOT NULL DEFAULT 'DAY',
  `status_crs` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_crs`),
  KEY `fk_selected_class` (`serial_clg`),
  KEY `fk_selected_level_speciality` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `course_director`
--

CREATE TABLE IF NOT EXISTS `course_director` (
  `serial_emp` int(11) DEFAULT NULL,
  `serial_crs` int(11) DEFAULT NULL,
  `status_crd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_144` (`serial_emp`),
  KEY `fk_relationship_145` (`serial_crs`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `credits_detail`
--

CREATE TABLE IF NOT EXISTS `credits_detail` (
  `serial_cdt` int(11) NOT NULL AUTO_INCREMENT,
  `serial_hrs` int(11) DEFAULT NULL,
  `start_at_cdt` time NOT NULL,
  `end_at_cdt` time NOT NULL,
  `status_cdt` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_cdt`),
  KEY `fk_relationship_269` (`serial_hrs`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `credit_card`
--

CREATE TABLE IF NOT EXISTS `credit_card` (
  `serial_ccd` int(11) NOT NULL AUTO_INCREMENT,
  `name_ccd` varchar(200) NOT NULL,
  `status_ccd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ccd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `currency`
--

CREATE TABLE IF NOT EXISTS `currency` (
  `serial_crr` int(11) NOT NULL AUTO_INCREMENT,
  `abrevation_crr` varchar(4) DEFAULT NULL,
  `name_crr` varchar(300) NOT NULL,
  `status_crr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_crr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `current_deferred`
--

CREATE TABLE IF NOT EXISTS `current_deferred` (
  `serial_cdf` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11),
  `serial_fic` int(11),
  `code_cdf` varchar(50) DEFAULT NULL,
  `total_quotas_cdf` int(11) NOT NULL,
  `quota_amount_cdf` decimal(10,2) NOT NULL,
  `paid_quotas_cdf` int(11) DEFAULT NULL,
  `last_month_paid_quota_cdf` varchar(3) DEFAULT NULL,
  `owner_cdf`            varchar(300) NOT NULL,
  `kinship_cdf`          varchar(300) NOT NULL,
  `transaction_date_cdf` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `students_cdf` varchar(60) DEFAULT NULL, 
  `credit_code_cdf` varchar(20) DEFAULT NULL, 
  `type_cdf` enum('ACADEMIC','NON_ACADEMIC') NOT NULL,	
  `status_cdf` enum('ACTIVE','INACTIVE','PAID') NOT NULL DEFAULT 'ACTIVE',
  `confirm_status_cdf` enum('NEW','PENDING','OK','KO') NOT NULL DEFAULT 'NEW',
  PRIMARY KEY (`serial_cdf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `degree`
--

CREATE TABLE IF NOT EXISTS `degree` (
  `serial_dgr` int(11) NOT NULL AUTO_INCREMENT,
  `name_dgr` varchar(255) NOT NULL,
  `status_dgr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_dgr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `discipline`
--

CREATE TABLE IF NOT EXISTS `discipline` (
  `serial_prd` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `supervisor_grade_dsc` decimal(8,5) DEFAULT NULL,
  `subjects_grade_dsc` decimal(8,5) DEFAULT NULL,
  `general_grade_dsc` decimal(8,5) DEFAULT NULL,
  PRIMARY KEY (`serial_prd`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_130` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `discount`
--

CREATE TABLE IF NOT EXISTS `discount` (
  `serial_dsc` int(11) NOT NULL AUTO_INCREMENT,
  `name_dsc` varchar(200) NOT NULL,
  `status_dsc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_dsc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `discount_payment_concept`
--

CREATE TABLE IF NOT EXISTS `discount_payment_concept` (
  `serial_ydc` int(11) NOT NULL,
  `serial_pct` int(11) NOT NULL,
  `status_dpc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ydc`,`serial_pct`),
  KEY `fk_relationship_227` (`serial_pct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `employee`
--

CREATE TABLE IF NOT EXISTS `employee` (
  `serial_emp` int(11) NOT NULL AUTO_INCREMENT,
  `serial_tdg` int(11) DEFAULT NULL,
  `serial_usr` int(11) NOT NULL,
  `serial_grd` int(11) DEFAULT NULL,
  `serial_mdg` int(11) DEFAULT NULL,
  `serial_ste` int(11) DEFAULT NULL,
  `serial_cou` int(11) DEFAULT NULL,
  `serial_nnt` int(11) DEFAULT NULL,
  `serial_tst` int(11) DEFAULT NULL,
  `serial_unv` int(11) DEFAULT NULL,
  `serial_tmd` int(11) DEFAULT NULL,
  `serial_dgr` int(11) DEFAULT NULL,
  `id_emp` varchar(13) NOT NULL,
  `type_emp` set('TEACHING','ADMINISTRATIVE','SERVICES') DEFAULT NULL,
  `status_emp` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `first_name_emp` varchar(255) NOT NULL,
  `last_name_emp` varchar(255) NOT NULL,
  `specialty_emp` varchar(150) DEFAULT NULL,
  `gender_emp` enum('MALE','FEMALE') NOT NULL,
  `marital_status_emp` enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS') DEFAULT NULL,
  `birthdate_emp` date NOT NULL,
  `address_emp` text NOT NULL,
  `city_emp` varchar(150) NOT NULL,
  `parish_emp` varchar(100) DEFAULT NULL,
  `sector_emp` varchar(50) DEFAULT NULL,
  `phone_emp` varchar(30) NOT NULL,
  `phone2_emp` varchar(30) DEFAULT NULL,
  `phone3_emp` varchar(30) DEFAULT NULL,
  `cellphone_emp` varchar(30) DEFAULT NULL,
  `email_emp` varchar(150) DEFAULT NULL,
  `email2_emp` varchar(150) DEFAULT NULL,
  `family_dependents_emp` int(11) DEFAULT NULL,
  `student_dependents_emp` int(11) DEFAULT NULL,
  `teaching_since_tea_emp` date DEFAULT NULL,
  `seniority_university_tea_emp` int(11) DEFAULT NULL,
  `date_start_in_school_emp` date NOT NULL,
  PRIMARY KEY (`serial_emp`),
  KEY `fk_employee_birth_country` (`serial_cou`),
  KEY `fk_employee_birth_state` (`serial_ste`),
  KEY `fk_employee_guardian2` (`serial_grd`),
  KEY `fk_employee_user` (`serial_usr`),
  KEY `fk_relationship_54` (`serial_nnt`),
  KEY `fk_relationship_55` (`serial_tdg`),
  KEY `fk_relationship_56` (`serial_tmd`),
  KEY `fk_relationship_57` (`serial_tst`),
  KEY `fk_relationship_58` (`serial_dgr`),
  KEY `fk_relationship_59` (`serial_mdg`),
  KEY `fk_relationship_60` (`serial_unv`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `employee_area`
--

CREATE TABLE IF NOT EXISTS `employee_area` (
  `serial_aca` int(11) NOT NULL,
  `serial_emp` int(11) NOT NULL,
  `is_director_eba` enum('YES','NO') DEFAULT 'NO',
  `status_eba` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_aca`,`serial_emp`),
  KEY `fk_employee_in_area` (`serial_emp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `equipment`
--

CREATE TABLE IF NOT EXISTS `equipment` (
  `serial_eqt` int(11) NOT NULL AUTO_INCREMENT,
  `code_eqt` varchar(20) DEFAULT NULL,
  `name_eqt` varchar(512) DEFAULT NULL,
  `partial_damage_value_eqt` decimal(10,0) DEFAULT NULL,
  `total_damage_value_eqt` decimal(10,0) DEFAULT NULL,
  `status_eqt` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `available_eqt` enum('YES','NO') NOT NULL DEFAULT 'YES',
  PRIMARY KEY (`serial_eqt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `family`
--

create table family
(
  `serial_fml` int(11) NOT NULL AUTO_INCREMENT,
  `first_surname_fml` varchar(255) NOT NULL,
  `last_surname_fml` varchar(255) DEFAULT NULL,
  `address_fml` text DEFAULT NULL,
  `phone_fml` varchar(255) DEFAULT NULL,
  `status_fml` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_fml`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `family_guardian`
--

create table family_guardian
(
  `serial_grd` int(11) NOT NULL,
  `serial_fml` int(11) NOT NULL,
  `status_fmg` ENUM('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_grd`, `serial_fml`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `financial_institution`
--

CREATE TABLE IF NOT EXISTS `financial_institution` (
  `serial_fin` int(11) NOT NULL AUTO_INCREMENT,
  `name_fin` varchar(255) NOT NULL,
  `phone1_fin` varchar(30) NOT NULL,
  `phone2_fin` varchar(30) NOT NULL,
  `status_fin` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_fin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `financial_institution_card`
--

CREATE TABLE IF NOT EXISTS `financial_institution_card` (
  `serial_fic` int(11) NOT NULL AUTO_INCREMENT,
  `serial_fin` int(11) NOT NULL,
  `serial_ccd` int(11) NOT NULL,
  `wizard_fic` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `current_deferred_fic` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `status_fic` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_fic`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `general_activity`
--

CREATE TABLE IF NOT EXISTS `general_activity` (
  `serial_gac` int(11) NOT NULL AUTO_INCREMENT,
  `title_gac` varchar(50) NOT NULL,
  `description_gac` text NOT NULL,
  `create_date_gac` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `from_date_gac` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `to_date_gac` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `type_gac` enum('GENERAL','PERSONAL') NOT NULL DEFAULT 'GENERAL',
  `attachment_gac` varchar(128) DEFAULT NULL,
  `filename_gac` varchar(128) DEFAULT NULL,
  `status_gac` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gac`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `general_activity_attendees`
--

CREATE TABLE IF NOT EXISTS `general_activity_attendees` (
  `serial_gaa` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_gac` int(11) DEFAULT NULL,
  `type_gaa` enum('ALL','SECTION','COURSE','PERSONAL','TEACHER','EMPLOYEE','ACADEMIC_AREA') NOT NULL,
  `remote_id_gaa` int(11) DEFAULT NULL,
  `comments_gaa` text,
  `status_gaa` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gaa`),
  KEY `fk_relationship_139` (`serial_scy`),
  KEY `fk_relationship_140` (`serial_gac`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `general_discipline_log`
--

CREATE TABLE IF NOT EXISTS `general_discipline_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_prd` 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,
  `change_date_gdl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_gdl` decimal(8,5) NOT NULL,
  `comment_gdl` text,
  KEY `fk_relationship_151` (`serial_usr`),
  KEY `fk_relationship_152` (`serial_prd`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_153` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `grade_change_log`
--

CREATE TABLE IF NOT EXISTS `grade_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_att` int(11) DEFAULT NULL,
  `serial_prd` int(11) DEFAULT NULL,
  `serial_gct` int(11) DEFAULT NULL,
  `serial_act` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `serial_crs` int(11) DEFAULT NULL,
  `change_date_gcl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_gcl` decimal(8,5) DEFAULT NULL,
  `comment_gcl` text,
  KEY `fk_relationship_123` (`serial_sbc`,`serial_att`,`serial_prd`,`serial_gct`,`serial_act`,`serial_std`,`serial_crs`),
  KEY `fk_relationship_124` (`serial_usr`),
  KEY `fk_relationship_150` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `grade_criteria`
--

CREATE TABLE IF NOT EXISTS `grade_criteria` (
  `serial_gct` int(11) NOT NULL AUTO_INCREMENT,
  `name_gct` varchar(256) NOT NULL,
  `description_gct` text NOT NULL,
  `status_gct` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `grade_score_change_log`
--

CREATE TABLE IF NOT EXISTS `grade_score_change_log` (
  `serial_chr` int(11) DEFAULT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_ygs` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `change_date_gsl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_gsl` decimal(8,5) NOT NULL,
  `comment_gsl` text,
  KEY `fk_relationship_237` (`serial_ygs`,`serial_std`),
  KEY `fk_relationship_238` (`serial_chr`),
  KEY `fk_relationship_239` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `grade_subject_score`
--

CREATE TABLE IF NOT EXISTS `grade_subject_score` (
  `serial_ygs` int(11) NOT NULL,
  `serial_std` int(11) NOT 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,
  `score_gss` decimal(8,5) DEFAULT NULL,
  `status_gss` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ygs`,`serial_std`),
  KEY `fk_relationship_177` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `group_hour`
--

CREATE TABLE IF NOT EXISTS `group_hour` (
  `serial_gph` int(11) NOT NULL AUTO_INCREMENT,
  `name_gph` varchar(100) NOT NULL,
  `description_gph` text,
  `status_gph` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gph`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `group_hour_level`
--

CREATE TABLE IF NOT EXISTS `group_hour_level` (
  `serial_gph` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `working_days_ghl` set('MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY') DEFAULT NULL,
  `status_ghl` enum('ACTIVE','INACTIVE') DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gph`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_levels_in_group_hour` (`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `group_optional_subject`
--

CREATE TABLE IF NOT EXISTS `group_optional_subject` (
  `serial_osb` int(11) DEFAULT NULL,
  `serial_lop` int(11) DEFAULT NULL,
  `status_gos` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_281` (`serial_osb`),
  KEY `fk_relationship_282` (`serial_lop`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `guardian`
--

CREATE TABLE IF NOT EXISTS `guardian` (
  `serial_grd` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11) NOT NULL,
  `serial_emp` int(11) DEFAULT NULL,
  `id_grd` varchar(13) NOT NULL,
  `first_name_grd` varchar(512) NOT NULL,
  `last_name_grd` varchar(512) NOT NULL,
  `birthdate_grd` date DEFAULT NULL,
  `gender_grd` enum('MALE','FEMALE') NOT NULL,
  `marital_status_grd` enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS') NOT NULL DEFAULT 'MARRIED',
  `alumnus_grd` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `address_grd` text NOT NULL,
  `phone_grd` varchar(30) NOT NULL,
  `mobile_grd` varchar(30) DEFAULT NULL,
  `occupation_grd` varchar(50) DEFAULT NULL,
  `company_name_grd` varchar(100) DEFAULT NULL,
  `company_activity_grd` varchar(80) DEFAULT NULL,
  `company_phone_grd` varchar(13) DEFAULT NULL,
  `email_grd` varchar(256) DEFAULT NULL,
  `email2_grd` varchar(150) DEFAULT NULL,
  `status_grd` enum('ACTIVE','INACTIVE','BLOCKED') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_grd`),
  KEY `fk_employee_guardian` (`serial_emp`),
  KEY `fk_guardian_user` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `guest`
--

CREATE TABLE IF NOT EXISTS `guest` (
  `serial_gst` int(11) NOT NULL AUTO_INCREMENT,
  `id_gst` varchar(20) NOT NULL,
  `first_name_gst` varchar(128) NOT NULL,
  `last_name_gst` varchar(128) NOT NULL,
  `birthdate_gst` date NOT NULL,
  `gender_gst` enum('MALE','FEMALE') NOT NULL,
  `status_gst` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gst`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `hour`
--

CREATE TABLE IF NOT EXISTS `hour` (
  `serial_hrs` int(11) NOT NULL AUTO_INCREMENT,
  `start_hrs` time NOT NULL,
  `end_hrs` time NOT NULL,
  `status_hrs` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_hrs`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `hour_by_group`
--

CREATE TABLE IF NOT EXISTS `hour_by_group` (
  `serial_hbg` int(11) NOT NULL AUTO_INCREMENT,
  `serial_hrs` int(11) DEFAULT NULL,
  `serial_gph` int(11) DEFAULT NULL,
  `status_hbg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `credits_hbg` int(11) DEFAULT NULL,
  `type_hbg` enum('NORMAL','LUNCH') NOT NULL DEFAULT 'NORMAL',
  PRIMARY KEY (`serial_hbg`),
  KEY `fk_for_group` (`serial_gph`),
  KEY `fk_is_in_group` (`serial_hrs`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `incident`
--

CREATE TABLE IF NOT EXISTS `incident` (
  `serial_inc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11) DEFAULT NULL,
  `use_serial_usr` int(11) DEFAULT NULL,
  `date_inc` date NOT NULL,
  `report_date_inc` date NOT NULL,
  `description_inc` text NOT NULL,
  PRIMARY KEY (`serial_inc`),
  KEY `fk_relationship_194` (`use_serial_usr`),
  KEY `fk_relationship_195` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `income_stock`
--

CREATE TABLE IF NOT EXISTS `income_stock` (
  `serial_ist` int(11) NOT NULL AUTO_INCREMENT,
  `serial_prv` int(11) DEFAULT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_mti` int(11) DEFAULT NULL,
  `income_ist` decimal(5,2) NOT NULL,
  `cost_ist` decimal(5,2) NOT NULL,
  `income_date_ist` date NOT NULL,
  `available_ist` decimal(5,2) NOT NULL,
  PRIMARY KEY (`serial_ist`),
  KEY `fk_relationship_184` (`serial_prv`),
  KEY `fk_relationship_185` (`serial_mti`),
  KEY `fk_relationship_186` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `invoice`
--

CREATE TABLE IF NOT EXISTS `invoice` (
  `serial_phy` int(11) NOT NULL AUTO_INCREMENT,
  `payment_date_phy` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `subtotal_phy` decimal(10,2) NOT NULL,
  `taxes_phy` decimal(10,2) NOT NULL,
  `total_phy` decimal(10,2) NOT NULL,
  `id_paying_phy` varchar(15) DEFAULT NULL,
  `name_paying_phy` varchar(512) DEFAULT NULL,
  `phone_paying_phy` varchar(30) DEFAULT NULL,
  `address_paying_phy` varchar(1024) DEFAULT NULL,
  `physical_number_phy` varchar(128) DEFAULT NULL,
  `month_phy` varchar(3) NOT NULL,
  `due_date_phy` date NOT NULL,
  `status_phy` enum('ACTIVE','INACTIVE','PAID','VOID') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_phy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `invoice_detail`
--

CREATE TABLE IF NOT EXISTS `invoice_detail` (
  `serial_cdf` int(11) DEFAULT NULL,
  `serial_sva` int(11) DEFAULT NULL,
  `serial_deb` int(11) DEFAULT NULL,
  `serial_phy` int(11) DEFAULT NULL,
  `status_psd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_155` (`serial_phy`),
  KEY `fk_relationship_156` (`serial_deb`),
  KEY `fk_relationship_171` (`serial_cdf`),
  KEY `fk_relationship_231` (`serial_sva`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `item_category`
--

CREATE TABLE IF NOT EXISTS `item_category` (
  `serial_ict` int(11) NOT NULL AUTO_INCREMENT,
  `name_ict` varchar(160) NOT NULL,
  `description_ict` text NOT NULL,
  `status_ict` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ict`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `language`
--

CREATE TABLE IF NOT EXISTS `language` (
  `serial_lng` int(11) NOT NULL AUTO_INCREMENT,
  `abbreviation_lng` varchar(3) DEFAULT NULL,
  `name_lng` varchar(50) NOT NULL,
  PRIMARY KEY (`serial_lng`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `level`
--

CREATE TABLE IF NOT EXISTS `level` (
  `serial_lvl` int(11) NOT NULL AUTO_INCREMENT,
  `name_lvl` varchar(150) NOT NULL,
  `description_lvl` text,
  `status_lvl` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_lvl`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `level_optional_group`
--

CREATE TABLE IF NOT EXISTS `level_optional_group` (
  `serial_lop` int(11) NOT NULL AUTO_INCREMENT,
  `serial_spt` int(11) DEFAULT NULL,
  `serial_lvl` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_set` int(11) DEFAULT NULL,
  `name_lop` varchar(256) NOT NULL,
  `status_lop` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `hours_week_lop` int(11) NOT NULL,
  `hours_distribution_lop` varchar(512) DEFAULT NULL,
  PRIMARY KEY (`serial_lop`),
  KEY `fk_relationship_243` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `level_optional_group_detail`
--

CREATE TABLE IF NOT EXISTS `level_optional_group_detail` (
  `serial_prd` int(11) NOT NULL,
  `serial_lop` int(11) NOT NULL,
  `weight_ogd` decimal(5,2) NOT NULL,
  `status_ogd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_prd`,`serial_lop`),
  KEY `fk_relationship_244` (`serial_lop`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `level_section_year`
--

CREATE TABLE IF NOT EXISTS `level_section_year` (
  `serial_pgy` int(11) DEFAULT NULL,
  `serial_lvl` int(11) NOT NULL,
  `discipline_lsy` enum('SUPERVISOR','TEACHERS','BOTH') DEFAULT NULL,
  `supervisor_grade_weight_lsy` decimal(5,2) DEFAULT NULL,
  `teacher_grade_weight_lsy` decimal(5,2) DEFAULT NULL,
  `order_lsy` int(11) DEFAULT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `status_lsy` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_period_group_level` (`serial_pgy`),
  KEY `fk_section_for_level` (`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `level_section_year_specialty`
--

CREATE TABLE IF NOT EXISTS `level_section_year_specialty` (
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `status_lss` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_selected_level` (`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `library_section`
--

CREATE TABLE IF NOT EXISTS `library_section` (
  `serial_lst` int(11) NOT NULL AUTO_INCREMENT,
  `name_lst` varchar(128) NOT NULL,
  `status_lst` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_lst`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `loan`
--

CREATE TABLE IF NOT EXISTS `loan` (
  `serial_loa` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11) DEFAULT NULL,
  `date_loa` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `due_date_loa` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status_loa` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_loa`),
  KEY `fk_relationship_280` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `loan_detail`
--

CREATE TABLE IF NOT EXISTS `loan_detail` (
  `serial_stp` int(11) DEFAULT NULL,
  `serial_bkc` int(11) DEFAULT NULL,
  `serial_loa` int(11) DEFAULT NULL,
  `serial_eqt` int(11) DEFAULT NULL,
  `returned_ldt` enum('YES','NO') NOT NULL DEFAULT 'NO',
  KEY `fk_relationship_276` (`serial_eqt`),
  KEY `fk_relationship_277` (`serial_stp`),
  KEY `fk_relationship_278` (`serial_bkc`),
  KEY `fk_relationship_279` (`serial_loa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `maintenance_item`
--

CREATE TABLE IF NOT EXISTS `maintenance_item` (
  `serial_mti` int(11) NOT NULL AUTO_INCREMENT,
  `serial_ict` int(11) DEFAULT NULL,
  `name_mti` varchar(160) NOT NULL,
  `description_mti` text NOT NULL,
  `brand_mti` varchar(128) NOT NULL,
  `status_mti` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_mti`),
  KEY `fk_relationship_183` (`serial_ict`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `master_degree`
--

CREATE TABLE IF NOT EXISTS `master_degree` (
  `serial_mdg` int(11) NOT NULL AUTO_INCREMENT,
  `name_mdg` varchar(255) NOT NULL,
  `status_mdg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_mdg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `medical_file`
--

CREATE TABLE IF NOT EXISTS `medical_file` (
  `serial_mdf` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_gst` int(11) DEFAULT NULL,
  `chronic_disease_mdf` text,
  `weight_mdf` decimal(5,2) NOT NULL,
  `allergy_mdf` text,
  `allergy_medication_mdf` text,
  `reaction_medicine_mdf` text,
  `fever_medication_mdf` text NOT NULL,
  `headache_medication_mdf` text NOT NULL,
  `stomachache_medication_mdf` text NOT NULL,
  `registration_date_mdf` date NOT NULL,
  `status_mdf` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `family_physician_mdf` varchar(256) DEFAULT NULL,
  `emergency_call_name_mdf` varchar(256) DEFAULT NULL,
  `emergency_call_name2_mdf` varchar(256) DEFAULT NULL,
  `emergency_call_phone_mdf` varchar(13) DEFAULT NULL,
  `emergency_call_phone2_mdf` varchar(13) DEFAULT NULL,
  `hospital_preference1_mdf` varchar(200) DEFAULT NULL,
  `hospital_preference2_mdf` varchar(200) DEFAULT NULL,
  `blood_type_mdf` varchar(10) DEFAULT NULL,
  `restrictions_mdf` text,
  `emergency_auth_mdf` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `physician_mobile_mdf` varchar(30) DEFAULT NULL,
  `physician_office_mdf` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`serial_mdf`),
  KEY `fk_relationship_196` (`serial_gst`),
  KEY `fk_relationship_65` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `message`
--

CREATE TABLE IF NOT EXISTS `message` (
  `serial_msg` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr_receive` int(11) DEFAULT NULL,
  `serial_prf` int(11) DEFAULT NULL,
  `serial_usr_send` int(11) DEFAULT NULL,
  `type_msg` enum('PRIVATE','PUBLIC') NOT NULL DEFAULT 'PUBLIC',
  `user_from_name_msg` varchar(256) NOT NULL,
  `user_to_name_msg` varchar(256) NOT NULL,
  `subject_msg` varchar(128) NOT NULL,
  `message_msg` text NOT NULL,
  `checked_msg` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `saved_msg` enum('YES','NO') DEFAULT 'NO',
  `deleted_msg` enum('YES','NO') DEFAULT 'NO',
  `removed_permanently_msg` enum('YES','NO') DEFAULT 'NO',
  `send_date_msg` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `check_date_msg` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `filename_msg` varchar(50) DEFAULT NULL,
  `attachment_msg` varchar(50) DEFAULT NULL,
  `priority_msg` enum('URGENT','NORMAL') NOT NULL DEFAULT 'NORMAL',
  PRIMARY KEY (`serial_msg`),
  KEY `fk_relationship_136` (`serial_usr_send`),
  KEY `fk_relationship_137` (`serial_usr_receive`),
  KEY `fk_relationship_154` (`serial_prf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `message_between_profiles`
--

CREATE TABLE IF NOT EXISTS `message_between_profiles` (
  `serial_prf` int(11) NOT NULL,
  `pro_serial_prf` int(11) NOT NULL,
  `status_mbp` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_prf`,`pro_serial_prf`),
  KEY `fk_relationship_142` (`pro_serial_prf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `message_thread`
--

CREATE TABLE IF NOT EXISTS `message_thread` (
  `serial_mth` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11) DEFAULT NULL,
  `start_date_mth` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`serial_mth`),
  KEY `fk_relationship_138` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `message_thread_messages`
--

CREATE TABLE IF NOT EXISTS `message_thread_messages` (
  `serial_mtm` int(11) NOT NULL AUTO_INCREMENT,
  `serial_mth` int(11) DEFAULT NULL,
  `serial_msg` int(11) DEFAULT NULL,
  PRIMARY KEY (`serial_mtm`),
  KEY `fk_relationship_134` (`serial_mth`),
  KEY `fk_relationship_135` (`serial_msg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `ministry_resit_change_log`
--


CREATE TABLE IF NOT EXISTS `ministry_resit_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_msb` 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,
  `change_date_mrc` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_mrc` decimal(8,5) NOT NULL,
  `comment_mrc` text,
  KEY `fk_relationship_254` (`serial_msb`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_257` (`serial_usr`),
  KEY `fk_relationship_258` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `ministry_resit_student`
--

CREATE TABLE IF NOT EXISTS `ministry_resit_student` (
  `serial_msb` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,

  `serial_set` int(11) NOT NULL,
  `required_grade_mrs` decimal(8,5) NOT NULL,
  `grade_mrs` decimal(8,5) DEFAULT NULL,
  `status_mrs` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_msb`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_255` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `ministry_subject`
--

CREATE TABLE IF NOT EXISTS `ministry_subject` (
  `serial_msb` int(11) NOT NULL AUTO_INCREMENT,
  `name_msb` varchar(256) NOT NULL,
  `description_msb` text NOT NULL,
  `grade_type_msb` enum('QUALITATIVE','QUANTITATIVE') NOT NULL DEFAULT 'QUANTITATIVE',
  `status_msb` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_msb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `nationality`
--

CREATE TABLE IF NOT EXISTS `nationality` (
  `serial_nnt` int(11) NOT NULL AUTO_INCREMENT,
  `name_nnt` varchar(255) NOT NULL,
  `status_nnt` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_nnt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `optional_subject`
--

CREATE TABLE IF NOT EXISTS `optional_subject` (
  `serial_osb` int(11) NOT NULL AUTO_INCREMENT,
  `serial_pgy` int(11) DEFAULT NULL,
  `serial_csb` int(11) DEFAULT NULL,
  `per_serial_pgy` int(11) DEFAULT NULL,
  `serial_aca` int(11) DEFAULT NULL,
  `serial_emp` int(11) DEFAULT NULL,
  `status_osb` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `grade_type_sbc` enum('QUALITATIVE','QUANTITATIVE') NOT NULL DEFAULT 'QUANTITATIVE',
  PRIMARY KEY (`serial_osb`),
  KEY `fk_relationship_116` (`per_serial_pgy`),
  KEY `fk_relationship_127` (`serial_aca`,`serial_emp`),
  KEY `fk_relationship_249` (`serial_pgy`),
  KEY `fk_relationship_53` (`serial_csb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `optional_subject_level`
--

CREATE TABLE IF NOT EXISTS `optional_subject_level` (
  `serial_osb` 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,
  `status_osl` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_104` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_105` (`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `optional_subject_period`
--

CREATE TABLE IF NOT EXISTS `optional_subject_period` (
  `serial_prd` int(11) NOT NULL,
  `serial_osb` int(11) NOT NULL,
  `status_osp` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_prd`,`serial_osb`),
  KEY `fk_relationship_106` (`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `optional_subject_retest`
--

CREATE TABLE IF NOT EXISTS `optional_subject_retest` (
  `serial_osr` int(11) NOT NULL AUTO_INCREMENT,
  `serial_prd` int(11) DEFAULT NULL,
  `serial_osb` int(11) DEFAULT NULL,
  `description_osr` text NOT NULL,
  `sent_date_osr` date NOT NULL,
  `retest_date_osr` date NOT NULL,
  `weight_osr` decimal(5,2) NOT NULL,
  `status_osr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_osr`),
  KEY `fk_relationship_198` (`serial_prd`,`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `optional_subject_retest_student`
--

CREATE TABLE IF NOT EXISTS `optional_subject_retest_student` (
  `serial_std` int(11) NOT NULL,
  `serial_osr` int(11) NOT NULL,
  `grade_org` decimal(8,5) DEFAULT NULL,
  `status_org` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_std`,`serial_osr`),
  KEY `fk_relationship_199` (`serial_osr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `opt_activity`
--

CREATE TABLE IF NOT EXISTS `opt_activity` (
  `serial_opa` int(11) NOT NULL AUTO_INCREMENT,
  `name_opa` varchar(256) NOT NULL,
  `description_opa` text NOT NULL,
  `send_date_opa` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `due_date_opa` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status_opa` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_opa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `opt_activity_applied_criterias`
--

CREATE TABLE IF NOT EXISTS `opt_activity_applied_criterias` (
  `serial_opa` int(11) NOT NULL,
  `serial_gct` int(11) NOT NULL,
  `serial_osb` int(11) NOT NULL,
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `weight_oaa` decimal(5,2) DEFAULT NULL,
  `status_oaa` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_opa`,`serial_gct`,`serial_osb`,`serial_att`,`serial_prd`),
  KEY `fk_relationship_117` (`serial_gct`,`serial_osb`,`serial_att`,`serial_prd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `opt_activity_attachment`
--

CREATE TABLE IF NOT EXISTS `opt_activity_attachment` (
  `serial_oat` int(11) NOT NULL AUTO_INCREMENT,
  `serial_opa` int(11) DEFAULT NULL,
  `name_oat` varchar(256) NOT NULL,
  `filename_oat` varchar(256) NOT NULL,
  `status_oat` enum('ACTIVE','INACTIVE','DELETED') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_oat`),
  KEY `fk_relationship_119` (`serial_opa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `opt_grade_change_log`
--

CREATE TABLE IF NOT EXISTS `opt_grade_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_opa` int(11) DEFAULT NULL,
  `serial_gct` int(11) DEFAULT NULL,
  `serial_osb` int(11) DEFAULT NULL,
  `serial_att` int(11) DEFAULT NULL,
  `serial_prd` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `opt_change_date_ogc` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `opt_last_grade_ogc` decimal(8,5) DEFAULT NULL,
  `opt_comment_ogc` text,
  KEY `fk_relationship_125` (`serial_opa`,`serial_gct`,`serial_osb`,`serial_att`,`serial_prd`,`serial_std`),
  KEY `fk_relationship_126` (`serial_usr`),
  KEY `fk_relationship_149` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `opt_student_activity_attachment`
--

CREATE TABLE IF NOT EXISTS `opt_student_activity_attachment` (
  `serial_oth` int(11) NOT NULL AUTO_INCREMENT,
  `serial_opa` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `name_oth` varchar(256) NOT NULL,
  `filename_oth` varchar(256) NOT NULL,
  `status_oth` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_oth`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `opt_student_criteria_grade`
--

CREATE TABLE IF NOT EXISTS `opt_student_criteria_grade` (
  `serial_opa` int(11) NOT NULL,
  `serial_gct` int(11) NOT NULL,
  `serial_osb` int(11) NOT NULL,
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `grade_osg` decimal(8,5) DEFAULT NULL,
  `is_complete_osg` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `activity_grade_part_osg` decimal(6,2) DEFAULT NULL,
  `status_osg` enum('ACTIVE','INACTIVE','NOT_APPLY') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_opa`,`serial_gct`,`serial_osb`,`serial_att`,`serial_prd`,`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `opt_subject_period_activity_type`
--

CREATE TABLE IF NOT EXISTS `opt_subject_period_activity_type` (
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `serial_osb` int(11) NOT NULL,
  `weight_osa` decimal(5,2) NOT NULL,
  `due_min_days_osa` int(11) NOT NULL,
  `due_max_grade_osa` int(11) DEFAULT NULL,
  `status_osa` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_att`,`serial_prd`,`serial_osb`),
  KEY `fk_relationship_112` (`serial_prd`,`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `opt_subject_retest_change_log`
--

CREATE TABLE IF NOT EXISTS `opt_subject_retest_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `serial_osr` int(11) DEFAULT NULL,
  `change_date_orl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_orl` decimal(8,5) NOT NULL,
  `comment_orl` text,
  KEY `fk_relationship_215` (`serial_std`,`serial_osr`),
  KEY `fk_relationship_216` (`serial_usr`),
  KEY `fk_relationship_217` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `opt_subject_year_activity_criteria_period`
--

CREATE TABLE IF NOT EXISTS `opt_subject_year_activity_criteria_period` (
  `serial_gct` int(11) NOT NULL,
  `serial_osb` int(11) NOT NULL,
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `status_oac` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gct`,`serial_osb`,`serial_att`,`serial_prd`),
  KEY `fk_relationship_114` (`serial_att`,`serial_prd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `opt_subject_year_grade_criteria`
--

CREATE TABLE IF NOT EXISTS `opt_subject_year_grade_criteria` (
  `serial_gct` int(11) NOT NULL,
  `serial_osb` int(11) NOT NULL,
  `status_oyc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_gct`,`serial_osb`),
  KEY `fk_relationship_110` (`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `payment_agreement_group`
--

CREATE TABLE IF NOT EXISTS `payment_agreement_group` (
  `serial_pag` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `code_pag` varchar(10) NOT NULL,
  `description_pag` text,
  `status_pag` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_pag`),
  KEY `fk_relationship_292` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `payment_concept`
--

CREATE TABLE IF NOT EXISTS `payment_concept` (
  `serial_pct` int(11) NOT NULL AUTO_INCREMENT,
  `name_pct` varchar(200) NOT NULL,
  `status_pct` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_pct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `payment_detail`
--

CREATE TABLE IF NOT EXISTS `payment_detail` (
  `serial_pym` int(11) DEFAULT NULL,
  `serial_ccd` int(11) DEFAULT NULL,
  `serial_fin` int(11) DEFAULT NULL,
  `serial_phy` int(11) DEFAULT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `description_pdt` varchar(128) NOT NULL,
  `document_number_pdt` varchar(128) DEFAULT NULL,
  `amount_pdt` decimal(10,2) NOT NULL,
  `kinship_pdt` varchar(80) DEFAULT NULL,
  `owner_pdt` varchar(300) DEFAULT NULL,
  `date_pdt` date DEFAULT NULL,
  `status_pdt` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_172` (`serial_phy`),
  KEY `fk_relationship_173` (`serial_pym`),
  KEY `fk_relationship_191` (`serial_ccd`),
  KEY `fk_relationship_192` (`serial_fin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `payment_method`
--

CREATE TABLE IF NOT EXISTS `payment_method` (
  `serial_pym` int(11) NOT NULL AUTO_INCREMENT,
  `name_pym` varchar(128) NOT NULL,
  `requires_owner_info_pym` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `requires_financial_pym` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `requires_credit_card_pym` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `status_pym` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_pym`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `period`
--

CREATE TABLE IF NOT EXISTS `period` (
  `serial_prd` int(11) NOT NULL AUTO_INCREMENT,
  `serial_pgy` int(11) DEFAULT NULL,
  `name_prd` varchar(255) NOT NULL,
  `start_date_prd` date NOT NULL,
  `end_date_prd` date NOT NULL,
  `max_grade_date_prd` date NOT NULL,
  `status_prd` enum('ACTIVE','INACTIVE','BLOCKED','ENDED') NOT NULL DEFAULT 'ACTIVE',
  `min_grade_prd` decimal(8,5) NOT NULL,
  `max_grade_prd` decimal(8,5) NOT NULL,
  `warning_grade_prd` decimal(8,5) NOT NULL,
  `weight_prd` decimal(5,2) NOT NULL,
  PRIMARY KEY (`serial_prd`),
  KEY `fk_periods_by_group` (`serial_pgy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `period_group_year`
--

CREATE TABLE IF NOT EXISTS `period_group_year` (
  `serial_pgy` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_cpd` int(11) DEFAULT NULL,
  `name_pgy` varchar(255) DEFAULT NULL,
  `status_pgy` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_pgy`),
  KEY `fk_periods_in_year` (`serial_scy`),
  KEY `fk_period_for_year` (`serial_cpd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `pre_registration`
--

CREATE TABLE IF NOT EXISTS `pre_registration` (
  `serial_prt` int(11) NOT NULL AUTO_INCREMENT,
  `serial_ste` int(11) DEFAULT NULL,
  `serial_nnt` int(11) DEFAULT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_dgr` int(11) DEFAULT NULL,
  `id_prt` varchar(10) 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,
  `first_name_prt` varchar(512) NOT NULL,
  `last_name_prt` varchar(512) NOT NULL,
  `birthdate_prt` date NOT NULL,
  `gender_prt` enum('MALE','FEMALE') NOT NULL,
  `address_prt` text NOT NULL,
  `phone_prt` varchar(30) NOT NULL,
  `first_name_father_prt` varchar(100) DEFAULT NULL,
  `last_name_father_prt` varchar(100) DEFAULT NULL,
  `first_name_mother_prt` varchar(100) DEFAULT NULL,
  `last_name_mother_prt` varchar(100) DEFAULT NULL,
  `city_birth_prt` varchar(100) DEFAULT NULL,
  `blood_type_prt` varchar(10) DEFAULT NULL,
  `allergies_prt` text,
  `lives_with_prt`  enum('PARENTS','FATHER','MOTHER','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER') DEFAULT NULL,
  `photo_prt` varchar(1024) DEFAULT NULL,
  `email_prt` varchar(256) DEFAULT NULL,
  `rep_first_name_prt` varchar(100) NOT NULL,
  `rep_last_name_prt` varchar(100) NOT NULL,
  `rep_relationship_prt` enum('FATHER','MOTHER','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER') NOT NULL,
  `rep_birthdate_prt` date DEFAULT NULL,
  `rep_city_birth_prt` varchar(100) DEFAULT NULL,
  `rep_marital_status_prt` enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS') NOT NULL,
  `rep_occupation_prt` varchar(100) DEFAULT NULL,
  `rep_address_prt` text NOT NULL,
  `rep_phone_prt` varchar(13) NOT NULL,
  `rep_mobile_prt` varchar(13) DEFAULT NULL,
  `rep_company_name_prt` varchar(80) DEFAULT NULL,
  `rep_company_activity_prt` text,
  `rep_company_phone_prt` varchar(13) DEFAULT NULL,
  `rep_photo_prt` varchar(1024) NOT NULL,
  `rep_alumnus_prt` enum('YES','NO') NOT NULL,
  `rep_gender_prt` enum('MALE','FEMALE') NOT NULL,
  `rep_id_prt` varchar(13) NOT NULL,
  `rep_email_prt` varchar(256) DEFAULT NULL,
  `is_listener_prt` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `submitted_docs_prt` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `pre_approved_prt` enum('YES','NO','PENDING') NOT NULL DEFAULT 'PENDING',
  `pre_approved_comment_prt` text,
  `approved_prt` enum('YES','NO','PENDING') NOT NULL DEFAULT 'PENDING',
  `approved_comment_prt` text,
  PRIMARY KEY (`serial_prt`),
  KEY `fk_registered_nationality` (`serial_nnt`),
  KEY `fk_relationship_241` (`serial_ste`),
  KEY `fk_relationship_64` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_67` (`serial_dgr`),
  KEY `fk_user_register` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `pre_registration_period`
--

CREATE TABLE IF NOT EXISTS `pre_registration_period` (
  `serial_scy` int(11) DEFAULT NULL,
  `start_date_prp` date NOT NULL,
  `end_date_prp` date NOT NULL,
  `status_prp` enum('ACTIVE','INACTIVE','CLOSED','OPEN') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_73` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `pre_registration_required_documment`
--

CREATE TABLE IF NOT EXISTS `pre_registration_required_documment` (
  `serial_prt` int(11) DEFAULT NULL,
  `serial_ypd` int(11) DEFAULT NULL,
  `serial_wpr` int(11) DEFAULT NULL,
  `filename_pdc` varchar(500) DEFAULT NULL,
  `status_pdc` enum('PENDING','SUBMITTED') NOT NULL DEFAULT 'PENDING',
  KEY `fk_relationship_263` (`serial_ypd`),
  KEY `fk_relationship_264` (`serial_prt`),
  KEY `fk_relationship_265` (`serial_wpr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `process`
--

CREATE TABLE IF NOT EXISTS `process` (
  `serial_prc` int(11) NOT NULL AUTO_INCREMENT,
  `prc_serial_prc` int(11) DEFAULT NULL,
  `name_prc` varchar(150) NOT NULL,
  `link_prc` varchar(1024) NOT NULL,
  `weight_prc` decimal(5,1) NOT NULL,
  `status_prc` enum('LOCKABLE','NON-LOCKABLE') NOT NULL DEFAULT 'LOCKABLE',
  PRIMARY KEY (`serial_prc`),
  KEY `fk_parent_process` (`prc_serial_prc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `profile`
--

CREATE TABLE IF NOT EXISTS `profile` (
  `serial_prf` int(11) NOT NULL AUTO_INCREMENT,
  `name_prf` varchar(150) NOT NULL,
  `type_prf` enum('INTERNAL','EXTERNAL') NOT NULL,
  `status_prf` enum('ACTIVE','INACTIVE') NOT NULL,
  `owner_prf` enum('SYSTEM','USER') NOT NULL DEFAULT 'USER',
  PRIMARY KEY (`serial_prf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `profile_process`
--

CREATE TABLE IF NOT EXISTS `profile_process` (
  `serial_prf` int(11) DEFAULT NULL,
  `serial_prc` int(11) DEFAULT NULL,
  `status_ppr` enum('ACTIVE','BLOCKED') DEFAULT 'ACTIVE',
  KEY `fk_has_process` (`serial_prf`),
  KEY `fk_in_profile` (`serial_prc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `provider`
--

CREATE TABLE IF NOT EXISTS `provider` (
  `serial_prv` int(11) NOT NULL AUTO_INCREMENT,
  `name_prv` varchar(160) NOT NULL,
  `id_prv` varchar(15) NOT NULL,
  `address_prv` text NOT NULL,
  `phone1_prv` varchar(30) NOT NULL,
  `phone2_prv` varchar(30) DEFAULT NULL,
  `contact_name_prv` varchar(255) NOT NULL,
  `status_prv` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_prv`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `psychological_file`
--

CREATE TABLE IF NOT EXISTS `psychological_file` (
  `serial_pyf` int(11) NOT NULL AUTO_INCREMENT,
  `serial_std` int(11) DEFAULT NULL,
  `therapy_pyf` enum('PSYCHOLOGICAL','VERBAL','VISUAL','LEARNING','BEHAVIOUR','AUDITORY','FAMILY','OTHER') DEFAULT NULL,
  `discharged_pyf` enum('YES','NO') DEFAULT NULL,
  `diagnosis_pyf` text,
  `diagnosed_by_pyf` text,
  `therapy_time_pyf` text,
  `abandon_reason_pyf` text,
  `medication_pyf` text,
  `therapeutic_center_pyf` varchar(512) DEFAULT NULL,
  `registration_date_pyf` date NOT NULL,
  `status_pyf` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_pyf`),
  KEY `fk_relationship_89` (`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `qualifying_document`
--

CREATE TABLE IF NOT EXISTS `qualifying_document` (
  `serial_qdc` int(11) NOT NULL AUTO_INCREMENT,
  `name_qdc` varchar(256) NOT NULL,
  `description_qdc` text NOT NULL,
  `status_qdc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_qdc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `qualitative_equivalence`
--

CREATE TABLE IF NOT EXISTS `qualitative_equivalence` (
  `serial_qeq` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `lower_percentage_qeq` decimal(5,2) NOT NULL,
  `higher_percentage_qeq` decimal(5,2) NOT NULL,
  `name_qeq` varchar(50) NOT NULL,
  `code_qeq` varchar(15) NOT NULL,
  `status_qeq` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_qeq`),
  KEY `fk_relationship_161` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `request_detail`
--

CREATE TABLE IF NOT EXISTS `request_detail` (
  `serial_ist` int(11) DEFAULT NULL,
  `serial_srq` int(11) DEFAULT NULL,
  `item_quantity_rdt` decimal(5,2) NOT NULL,
  `status_rdt` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_188` (`serial_ist`),
  KEY `fk_relationship_189` (`serial_srq`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `resit_change_log`
--

CREATE TABLE IF NOT EXISTS `resit_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `remote_id_rst` 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_rst` enum('CSB','LOP') DEFAULT 'CSB',
  `change_date_rcl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_rcl` decimal(8,5) NOT NULL,
  `comment_rcl` text,
  KEY `fk_relationship_218` (`remote_id_rst`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`,`type_rst`),
  KEY `fk_relationship_219` (`serial_usr`),
  KEY `fk_relationship_220` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `resit_student`
--

CREATE TABLE IF NOT EXISTS `resit_student` (
  `serial_emp` int(11) NOT NULL,
  `remote_id_rst` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `required_grade_rst` decimal(8,5) NOT NULL,
  `grade_rst` decimal(8,5) DEFAULT NULL,
  `type_rst` enum('CSB','LOP') NOT NULL DEFAULT 'CSB',
  `status_rst` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`remote_id_rst`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`,`type_rst`),
  KEY `fk_relationship_209` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_211` (`serial_emp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `route`
--

CREATE TABLE IF NOT EXISTS `route` (
  `serial_rot` int(11) NOT NULL AUTO_INCREMENT,
  `code_rot` varchar(10) NOT NULL,
  `description_rot` text NOT NULL,
  `status_rot` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_rot`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `schedule`
--

CREATE TABLE IF NOT EXISTS `schedule` (
  `serial_scd` int(11) NOT NULL AUTO_INCREMENT,
  `serial_lop` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_clr` int(11) DEFAULT NULL,
  `serial_crs` int(11) DEFAULT NULL,
  `serial_emp` int(11) DEFAULT NULL,
  `serial_cdt` int(11) DEFAULT NULL,
  `day_scd` enum('MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY') NOT NULL,
  `status_scd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_scd`),
  KEY `fk_relationship_283` (`serial_cdt`),
  KEY `fk_relationship_284` (`serial_sbc`),
  KEY `fk_relationship_285` (`serial_crs`),
  KEY `fk_relationship_286` (`serial_lop`),
  KEY `fk_relationship_287` (`serial_emp`),
  KEY `fk_relationship_288` (`serial_clr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `school_setup`
--

CREATE TABLE IF NOT EXISTS `school_setup` (
  `serial_ste` int(11) DEFAULT NULL,
  `serial_crr` int(11) DEFAULT NULL,
  `name_sst` varchar(1024) NOT NULL,
  `city_sst` varchar(100) NOT NULL,
  `address_sst` text NOT NULL,
  `phone1_sst` varchar(30) NOT NULL,
  `phone2_sst` varchar(30) DEFAULT NULL,
  `phone3_sst` varchar(30) DEFAULT NULL,
  `contact_name_sst` varchar(250) NOT NULL,
  `contact_phone_sst` varchar(20) NOT NULL,
  `logo_sst` varchar(100) NOT NULL,
  `slogan_sst` varchar(300) DEFAULT NULL,
  `main_color_sst` varchar(7) NOT NULL,
  `secondary_color_sst` varchar(7) NOT NULL,
  KEY `fk_currency_for_school` (`serial_crr`),
  KEY `fk_school_state` (`serial_ste`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `school_year`
--

CREATE TABLE IF NOT EXISTS `school_year` (
  `serial_scy` int(11) NOT NULL AUTO_INCREMENT,
  `start_date_scy` date NOT NULL,
  `end_date_scy` date NOT NULL,
  `status_scy` set('ACTIVE','CURRENT','ENDED','NEW','INACTIVE') NOT NULL DEFAULT 'NEW',
  `name_scy` varchar(150) NOT NULL,
  `grade_precision_scy` int(11) NOT NULL,
  `invoice_due_max_day_scy` int(11) DEFAULT NULL,
  `ministry_max_grade_scy` decimal(6,2) NOT NULL,
  `school_max_grade_scy` decimal(6,2) NOT NULL,
  `matricule_process_scy` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'INACTIVE',
  `invoice_start_date_scy` date not null,
  `invoice_number_scy` int not null,
  PRIMARY KEY (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `section`
--

CREATE TABLE IF NOT EXISTS `section` (
  `serial_set` int(11) NOT NULL AUTO_INCREMENT,
  `name_set` varchar(150) NOT NULL,
  `description_set` text,
  `status_set` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `type_set` enum('DAY','EVENING','NIGHT') NOT NULL DEFAULT 'DAY',
  PRIMARY KEY (`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `section_by_year`
--

CREATE TABLE IF NOT EXISTS `section_by_year` (
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `status_sby` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_scy`,`serial_set`),
  KEY `fk_section_in_year` (`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `shift`
--

CREATE TABLE IF NOT EXISTS `shift` (
  `serial_sft` int(11) NOT NULL AUTO_INCREMENT,
  `name_sft` varchar(120) NOT NULL,
  `description_sft` text NOT NULL,
  `status_sft` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_sft`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `specialty`
--

CREATE TABLE IF NOT EXISTS `specialty` (
  `serial_spt` int(11) NOT NULL AUTO_INCREMENT,
  `name_spt` varchar(150) NOT NULL,
  `description_spt` text,
  `status_spt` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_spt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `special_grade_change_log`
--

CREATE TABLE IF NOT EXISTS `special_grade_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_ysg` 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,
  `change_date_sgl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_sgl` decimal(8,5) NOT NULL,
  `comment_sgl` text,
  KEY `fk_relationship_221` (`serial_ysg`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_222` (`serial_chr`),
  KEY `fk_relationship_223` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `state`
--

CREATE TABLE IF NOT EXISTS `state` (
  `serial_ste` int(11) NOT NULL AUTO_INCREMENT,
  `serial_cou` int(11) DEFAULT NULL,
  `name_ste` varchar(100) NOT NULL,
  `status_ste` enum('ACTIVE','INACTIVE') DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ste`),
  KEY `fk_country_state` (`serial_cou`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `stock_request`
--

CREATE TABLE IF NOT EXISTS `stock_request` (
  `serial_srq` int(11) NOT NULL AUTO_INCREMENT,
  `serial_udt` int(11) DEFAULT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `description_srq` text NOT NULL,
  `request_date_srq` date NOT NULL,
  `status_srq` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_srq`),
  KEY `fk_relationship_187` (`serial_udt`),
  KEY `fk_relationship_190` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `student`
--

CREATE TABLE IF NOT EXISTS `student` (
  `serial_std` int(11) NOT NULL AUTO_INCREMENT,
  `serial_ste` int(11) DEFAULT NULL,
  `serial_fml` int(11) DEFAULT NULL,
  `serial_usr` int(11) NOT NULL,
  `serial_nnt` int(11) DEFAULT NULL,
  `id_std` varchar(13) NOT NULL,
  `first_name_std` varchar(255) NOT NULL,
  `last_name_std` varchar(255) NOT NULL,
  `birthdate_std` date NOT NULL,
  `birthcity_std` varchar(80) DEFAULT NULL,
  `gender_std` enum('MALE','FEMALE') NOT NULL,
  `address_std` text,
  `phone_std` varchar(30) DEFAULT NULL,
  `type_std` enum('NEW','OLD') NOT NULL DEFAULT 'NEW',
  `email_std` varchar(256) DEFAULT NULL,
  `status_std` enum('ACTIVE','INACTIVE','BLOCKED') NOT NULL DEFAULT 'INACTIVE',
  `lives_with_std` enum('PARENTS','MOTHER','FATHER','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER') DEFAULT NULL,
  `first_name_mother_std` varchar(128) DEFAULT NULL,
  `last_name_mother_std` varchar(128) DEFAULT NULL,
  `phone_mother_std` varchar(30) DEFAULT NULL,
  `mobile_mother_std` varchar(30) DEFAULT NULL,
  `office_phone_mother_std` varchar(30) DEFAULT NULL,
  `first_name_father_std` varchar(128) DEFAULT NULL,
  `last_name_father_std` varchar(128) DEFAULT NULL,
  `phone_father_std` varchar(30) DEFAULT NULL,
  `mobile_father_std` varchar(30) DEFAULT NULL,
  `office_phone_father_std` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`serial_std`),
  KEY `fk_relationship_240` (`serial_ste`),
  KEY `fk_relationship_61` (`serial_nnt`),
  KEY `fk_student_user` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `student_activity_attachment`
--

CREATE TABLE IF NOT EXISTS `student_activity_attachment` (
  `serial_saa` int(11) NOT NULL AUTO_INCREMENT,
  `name_saa` varchar(256) NOT NULL,
  `filename_saa` varchar(256) NOT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `serial_act` int(11) DEFAULT NULL,
  `status_saa` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_saa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `student_by_course`
--

CREATE TABLE IF NOT EXISTS `student_by_course` (
  `serial_std` int(11) NOT NULL,
  `serial_crs` int(11) NOT NULL,
  `status_stc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_std`,`serial_crs`),
  KEY `fk_course_for_student` (`serial_crs`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `student_criteria_grade`
--

CREATE TABLE IF NOT EXISTS `student_criteria_grade` (
  `serial_sbc` int(11) NOT NULL,
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `serial_gct` int(11) NOT NULL,
  `serial_act` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `serial_crs` int(11) NOT NULL,
  `grade_scg` decimal(8,5) DEFAULT NULL,
  `is_complete_scg` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `activity_grade_part_scg` decimal(6,2) DEFAULT NULL,
  `status_scg` enum('ACTIVE','INACTIVE','NOT_APPLY') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_sbc`,`serial_att`,`serial_prd`,`serial_gct`,`serial_act`,`serial_std`,`serial_crs`),
  KEY `fk_relationship_100` (`serial_std`,`serial_crs`),
  KEY `fk_relationship_99` (`serial_att`,`serial_prd`,`serial_sbc`,`serial_gct`,`serial_act`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `student_guardian`
--

CREATE TABLE IF NOT EXISTS `student_guardian` (
  `serial_std` int(11) NOT NULL,
  `serial_grd` int(11) NOT NULL,
  `relationship_stg` enum('MOTHER','FATHER','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER') NOT NULL,
  `legal_guardian_stg` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `status_stg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_std`,`serial_grd`),
  KEY `fk_is_guardian` (`serial_grd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `student_optional_subject`
--

CREATE TABLE IF NOT EXISTS `student_optional_subject` (
  `serial_osb` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `serial_lop` int(11) NOT NULL,
  `status_sos` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_osb`,`serial_std`,`serial_prd`,`serial_lop`),
  KEY `fk_relationship_109` (`serial_std`),
  KEY `fk_relationship_246` (`serial_prd`,`serial_lop`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `student_subject_period_average`
--

CREATE TABLE IF NOT EXISTS `student_subject_period_average` (
  `serial_ssa` int(11) NOT NULL AUTO_INCREMENT,
  `stu_serial_ssa` int(11) DEFAULT NULL,
  `serial_lop` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_prd` 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,
  `average_ssa` decimal(8,5) DEFAULT NULL,
  PRIMARY KEY (`serial_ssa`),
  KEY `fk_relationship_248` (`stu_serial_ssa`),
  KEY `fk_relationship_250` (`serial_sbc`),
  KEY `fk_relationship_251` (`serial_lop`),
  KEY `fk_relationship_252` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_253` (`serial_prd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


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

--
-- Estructura de tabla para la tabla `student_subject_subperiod_average`
--

CREATE TABLE IF NOT EXISTS  `student_subject_subperiod_average` (
  `serial_sss ` int(11) NOT NULL AUTO_INCREMENT,
  `serial_lop` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_sbp` 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,
  `average_sss` decimal(8,5) DEFAULT NULL,
  PRIMARY KEY (`serial_sss`),
  KEY `fk_relationship_346` (`serial_sbp`),
  KEY `fk_relationship_347` (`serial_sbc`),
  KEY `fk_relationship_348` (`serial_lop`),
  KEY `fk_relationship_349` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


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

--
-- Estructura de tabla para la tabla `student_year`
--

CREATE TABLE IF NOT EXISTS `student_year` (
  `folio_number_sty` varchar(20) DEFAULT NULL,
  `matricule_number_sty` varchar(20) DEFAULT NULL,
  `is_listener_sty` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `comment_sty` text,
  `serial_std` int(11) NOT NULL,
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `serial_pag` int(11) DEFAULT NULL,
  `status_sty` enum('ACCEPTED','REGISTERED','MATRICULE','RETIRED') NOT NULL,
  `registration_type_sty` enum('ORDINARY','PASS','EXCEPTIONAL') NOT NULL DEFAULT 'ORDINARY',
  `debts_checked_sty`    enum('YES','NO') NOT NULL DEFAULT 'NO',
  PRIMARY KEY (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_291` (`serial_pag`),
  KEY `fk_relationship_75` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `student_year_debts`
--

CREATE TABLE IF NOT EXISTS `student_year_debts` (
  `serial_deb` int(11) NOT NULL AUTO_INCREMENT,
  `serial_std` int(11) DEFAULT NULL,
  `serial_ypc` int(11) DEFAULT NULL,
  `serial_pct` int(11) DEFAULT NULL,
  `total_deb` decimal(10,2) NOT NULL,
  `total_taxes_deb` decimal(10,2) NOT NULL,
  `article_quantity_deb` decimal(6,2) DEFAULT NULL,
  `start_date_deb` date NOT NULL,
  `status_deb` enum('PENDING','PAID','INACTIVE') NOT NULL DEFAULT 'PENDING',
  PRIMARY KEY (`serial_deb`),
  KEY `fk_relationship_102` (`serial_ypc`),
  KEY `fk_relationship_103` (`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `student_year_discount`
--

CREATE TABLE IF NOT EXISTS `student_year_discount` (
  `serial_std` int(11) NOT NULL,
  `serial_ydc` int(11) NOT NULL,
  `status_syn` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_std`,`serial_ydc`),
  KEY `fk_relationship_228` (`serial_ydc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `student_year_discount_values`
--

CREATE TABLE IF NOT EXISTS `student_year_discount_values` (
  `serial_sva` int(11) NOT NULL AUTO_INCREMENT,
  `serial_pct` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `serial_ydc` int(11) DEFAULT NULL,
  `discount_month_ydv` char(3) NOT NULL,
  `value_ydv` decimal(10,2) NOT NULL,
  `comment_ydv` varchar(128) DEFAULT NULL,
  `status_ydv` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_sva`),
  KEY `fk_relationship_230` (`serial_std`,`serial_ydc`),
  KEY `fk_relationship_235` (`serial_pct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `student_year_document`
--

CREATE TABLE IF NOT EXISTS `student_year_document` (
  `serial_yqd` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `delivered_syd` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `filename_syd` varchar(1024) DEFAULT NULL,
  `status_syd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_yqd`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_159` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `student_year_special_grade`
--

CREATE TABLE IF NOT EXISTS `student_year_special_grade` (
  `serial_ysg` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `grade_sys` decimal(6,2) DEFAULT NULL,
  `status_sys` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ysg`,`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_180` (`serial_std`,`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `study_place`
--

CREATE TABLE IF NOT EXISTS `study_place` (
  `serial_stp` int(11) NOT NULL AUTO_INCREMENT,
  `name_stp` varchar(128) NOT NULL,
  `description_stp` text NOT NULL,
  `available_stp` enum('YES','NO') NOT NULL DEFAULT 'YES',
  `status_stp` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_stp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `subject`
--

CREATE TABLE IF NOT EXISTS `subject` (
  `serial_sbj` int(11) NOT NULL AUTO_INCREMENT,
  `serial_csb` 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,
  `order_sbj` int(2) DEFAULT NULL,
  `status_sbj` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_sbj`),
  KEY `fk_subject_fo__level` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_year_subject` (`serial_csb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `subject_course`
--

CREATE TABLE IF NOT EXISTS `subject_course` (
  `serial_sbc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_sbj` int(11) DEFAULT NULL,
  `serial_crs` int(11) DEFAULT NULL,
  `serial_aca` int(11) DEFAULT NULL,
  `serial_emp` int(11) DEFAULT NULL,
  `status_sbc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `grade_type_sbc` enum('QUALITATIVE','QUANTITATIVE') NOT NULL DEFAULT 'QUANTITATIVE',
  `hours_week_sbc` int(11) NOT NULL,
  `hours_distribution_sbc` varchar(512) DEFAULT NULL,
  PRIMARY KEY (`serial_sbc`),
  KEY `fk_course_with_subject` (`serial_crs`),
  KEY `fk_is_teacher` (`serial_aca`,`serial_emp`),
  KEY `fk_subject_for_course` (`serial_sbj`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `subject_course_period`
--

CREATE TABLE IF NOT EXISTS `subject_course_period` (
  `serial_prd` int(11) NOT NULL,
  `serial_sbc` int(11) NOT NULL,
  `status_scp` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `weight_scp` decimal(5,2) DEFAULT NULL,
  PRIMARY KEY (`serial_prd`,`serial_sbc`),
  KEY `fk_relationship_72` (`serial_sbc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `subject_course_retest`
--

CREATE TABLE IF NOT EXISTS `subject_course_retest` (
  `serial_scr` int(11) NOT NULL AUTO_INCREMENT,
  `serial_prd` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `description_scr` text NOT NULL,
  `sent_date_scr` date NOT NULL,
  `retest_date_scr` date NOT NULL,
  `weight_scr` decimal(5,2) NOT NULL,
  `status_scr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_scr`),
  KEY `fk_relationship_201` (`serial_prd`,`serial_sbc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `subject_course_retest_student`
--

CREATE TABLE IF NOT EXISTS `subject_course_retest_student` (
  `serial_std` int(11) NOT NULL,
  `serial_scr` int(11) NOT NULL,
  `grade_srg` decimal(8,5) NOT NULL,
  `status_srg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_std`,`serial_scr`),
  KEY `fk_relationship_202` (`serial_scr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `subject_level_restriction`
--

CREATE TABLE IF NOT EXISTS `subject_level_restriction` (
  `serial_hbg` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_lop` int(11) DEFAULT NULL,
  `status_slr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_266` (`serial_lop`),
  KEY `fk_relationship_267` (`serial_sbc`),
  KEY `fk_relationship_268` (`serial_hbg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `subject_ministry_equivalence`
--

CREATE TABLE IF NOT EXISTS `subject_ministry_equivalence` (
  `serial_lop` int(11) DEFAULT NULL,
  `serial_emp` int(11) DEFAULT NULL,
  `serial_msb` int(11) DEFAULT NULL,
  `serial_csb` 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,
  `status_sme` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `order_sme` int(2) DEFAULT NULL,
  KEY `fk_relationship_166` (`serial_msb`),
  KEY `fk_relationship_169` (`serial_emp`),
  KEY `fk_relationship_193` (`serial_csb`),
  KEY `fk_relationship_204` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_247` (`serial_lop`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `subject_period_activity_type`
--

CREATE TABLE IF NOT EXISTS `subject_period_activity_type` (
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `serial_sbc` int(11) NOT NULL,
  `weight_spa` decimal(5,2) DEFAULT NULL,
  `due_min_days_spa` int(11) NOT NULL,
  `due_max_grade_spa` int(11) NOT NULL,
  `status_spa` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_att`,`serial_prd`,`serial_sbc`),
  KEY `fk_relationship_84` (`serial_prd`,`serial_sbc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `subject_retest_change_log`
--

CREATE TABLE IF NOT EXISTS `subject_retest_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `serial_scr` int(11) DEFAULT NULL,
  `change_date_srl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_grade_srl` decimal(8,5) NOT NULL,
  `comment_srl` text,
  KEY `fk_relationship_212` (`serial_std`,`serial_scr`),
  KEY `fk_relationship_213` (`serial_chr`),
  KEY `fk_relationship_214` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `subject_year_activity_criteria_period`
--

CREATE TABLE IF NOT EXISTS `subject_year_activity_criteria_period` (
  `serial_att` int(11) NOT NULL,
  `serial_prd` int(11) NOT NULL,
  `serial_sbc` int(11) NOT NULL,
  `serial_sbj` int(11) NOT NULL,
  `serial_gct` int(11) NOT NULL,
  `status_acp` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_att`,`serial_prd`,`serial_sbc`,`serial_sbj`,`serial_gct`),
  KEY `fk_relationship_87` (`serial_sbj`,`serial_gct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `subject_year_grade_criteria`
--

CREATE TABLE IF NOT EXISTS `subject_year_grade_criteria` (
  `serial_sbj` int(11) NOT NULL,
  `serial_gct` int(11) NOT NULL,
  `status_sgc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_sbj`,`serial_gct`),
  KEY `fk_relationship_83` (`serial_gct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `syllabus_files`
--

CREATE TABLE IF NOT EXISTS `syllabus_files` (
  `serial_syf` int(11) NOT NULL AUTO_INCREMENT,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_osb` int(11) DEFAULT NULL,
  `name_syf` varchar(256) NOT NULL,
  `description_syf` text NOT NULL,
  `filename_syf` varchar(128) NOT NULL,
  `status_syf` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_syf`),
  KEY `fk_relationship_128` (`serial_osb`),
  KEY `fk_relationship_129` (`serial_sbc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `syllabus_files_change_log`
--

CREATE TABLE IF NOT EXISTS `syllabus_files_change_log` (
  `serial_syf` int(11) DEFAULT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `change_date_scl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `old_data_scl` text NOT NULL,
  KEY `fk_relationship_132` (`serial_syf`),
  KEY `fk_relationship_133` (`serial_usr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `taxes`
--

CREATE TABLE IF NOT EXISTS `taxes` (
  `serial_tax` int(11) NOT NULL AUTO_INCREMENT,
  `name_tax` varchar(256) NOT NULL,
  `description_tax` text NOT NULL,
  `status_tax` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_tax`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `teacher_degree`
--

CREATE TABLE IF NOT EXISTS `teacher_degree` (
  `serial_tdg` int(11) NOT NULL AUTO_INCREMENT,
  `name_tdg` varchar(255) NOT NULL,
  `status_tdg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_tdg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `teacher_hours_year`
--

CREATE TABLE IF NOT EXISTS `teacher_hours_year` (
  `serial_thy` int(11) NOT NULL AUTO_INCREMENT,
  `serial_emp` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `start_hour_thy` time NOT NULL,
  `end_hour_thy` time NOT NULL,
  `status_thy` enum('ACTIVE','INACTIVE','ASSIGNED') NOT NULL DEFAULT 'ACTIVE',
  `labor_day_thy` enum('MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY') NOT NULL,
  PRIMARY KEY (`serial_thy`),
  KEY `fk_relationship_69` (`serial_emp`),
  KEY `fk_relationship_70` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `teacher_master_degree`
--

CREATE TABLE IF NOT EXISTS `teacher_master_degree` (
  `serial_tmd` int(11) NOT NULL AUTO_INCREMENT,
  `name_tmd` varchar(255) NOT NULL,
  `status_tmd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_tmd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `teacher_specialty`
--

CREATE TABLE IF NOT EXISTS `teacher_specialty` (
  `serial_tst` int(11) NOT NULL AUTO_INCREMENT,
  `name_tst` varchar(255) NOT NULL,
  `status_tst` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_tst`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `university`
--

CREATE TABLE IF NOT EXISTS `university` (
  `serial_unv` int(11) NOT NULL AUTO_INCREMENT,
  `name_unv` varchar(255) NOT NULL,
  `status_unv` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_unv`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `user`
--

CREATE TABLE IF NOT EXISTS `user` (
  `serial_usr` int(11) NOT NULL AUTO_INCREMENT,
  `serial_emp` int(11) DEFAULT NULL,
  `serial_grd` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `username_usr` varchar(150) NOT NULL,
  `password_usr` varchar(300) DEFAULT NULL,
  `photo_usr` varchar(1024) DEFAULT NULL,
  `status_usr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_usr`),
  KEY `fk_employee_user2` (`serial_emp`),
  KEY `fk_guardian_user2` (`serial_grd`),
  KEY `fk_student_user2` (`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `user_profile`
--

CREATE TABLE IF NOT EXISTS `user_profile` (
  `serial_usr` int(11) NOT NULL,
  `serial_prf` int(11) NOT NULL,
  `status_upr` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_usr`,`serial_prf`),
  KEY `fk_for_user` (`serial_prf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `use_destination`
--

CREATE TABLE IF NOT EXISTS `use_destination` (
  `serial_udt` int(11) NOT NULL AUTO_INCREMENT,
  `name_udt` varchar(200) NOT NULL,
  `description_udt` text NOT NULL,
  `status_udt` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_udt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `visits_medical_center`
--

CREATE TABLE IF NOT EXISTS `visits_medical_center` (
  `serial_vmc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_mdf` int(11) DEFAULT NULL,
  `date_vmc` date NOT NULL,
  `reason_vmc` text NOT NULL,
  `diagnosis_vmc` text NOT NULL,
  `filename_att_vmc` varchar(100) DEFAULT NULL,
  `attachment_vmc` varchar(100) DEFAULT NULL,
  `height_vmc` decimal(3,2) DEFAULT NULL,
  `weight_vmc` decimal(3,2) DEFAULT NULL,
  PRIMARY KEY (`serial_vmc`),
  KEY `fk_relationship_197` (`serial_mdf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `web_pre_registration`
--

CREATE TABLE IF NOT EXISTS `web_pre_registration` (
  `serial_wpr` int(11) NOT NULL AUTO_INCREMENT,
  `serial_wus` int(11) DEFAULT NULL,
  `serial_nnt` int(11) DEFAULT NULL,
  `serial_dgr` int(11) DEFAULT NULL,
  `serial_ste` int(11) DEFAULT NULL,
  `id_wpr` varchar(10) 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,
  `first_name_wpr` varchar(512) NOT NULL,
  `last_name_wpr` varchar(512) NOT NULL,
  `birthdate_wpr` date NOT NULL,
  `gender_wpr` enum('MALE','FEMALE') NOT NULL,
  `address_wpr` text NOT NULL,
  `phone_wpr` varchar(30) NOT NULL,
  `first_name_father_wpr` varchar(100) DEFAULT NULL,
  `last_name_father_wpr` varchar(100) DEFAULT NULL,
  `first_name_mother_wpr` varchar(100) DEFAULT NULL,
  `last_name_mother_wpr` varchar(100) DEFAULT NULL,
  `city_birth_wpr` varchar(100) DEFAULT NULL,
  `blood_type_wpr` varchar(10) DEFAULT NULL,
  `allergies_wpr` text,
  `lives_with_wpr` enum('PARENT','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER') NOT NULL,
  `photo_wpr` varchar(1024) DEFAULT NULL,
  `email_wpr` varchar(256) DEFAULT NULL,
  `rep_first_name_wpr` varchar(100) NOT NULL,
  `rep_last_name_wpr` varchar(100) NOT NULL,
  `rep_relationship_wpr` enum('PARENT','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER') NOT NULL,
  `rep_birthdate_wpr` date DEFAULT NULL,
  `rep_city_birth_wpr` varchar(100) DEFAULT NULL,
  `rep_marital_status_wpr` enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS') NOT NULL,
  `rep_occupation_wpr` varchar(100) DEFAULT NULL,
  `rep_address_wpr` text NOT NULL,
  `rep_phone_wpr` varchar(13) NOT NULL,
  `rep_mobile_wpr` varchar(13) DEFAULT NULL,
  `rep_company_name_wpr` varchar(80) DEFAULT NULL,
  `rep_company_activity_wpr` text,
  `rep_company_phone_wpr` varchar(13) DEFAULT NULL,
  `rep_photo_wpr` varchar(1024) DEFAULT NULL,
  `rep_gender_wpr` enum('MALE','FEMALE') NOT NULL,
  `rep_id_wpr` varchar(13) NOT NULL,
  `rep_email_wpr` varchar(256) DEFAULT NULL,
  `is_listener_wpr` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `submitted_docs_wpr` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `pre_approved_wpr` enum('YES','NO','PENDING') NOT NULL DEFAULT 'PENDING',
  `pre_approved_comment_wpr` text,
  `approved_wpr` enum('YES','NO','PENDING') NOT NULL DEFAULT 'PENDING',
  `approved_comment_wpr` text,
  PRIMARY KEY (`serial_wpr`),
  KEY `fk_relationship_205` (`serial_dgr`),
  KEY `fk_relationship_206` (`serial_nnt`),
  KEY `fk_relationship_207` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_208` (`serial_wus`),
  KEY `fk_relationship_242` (`serial_ste`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `web_user`
--

CREATE TABLE IF NOT EXISTS `web_user` (
  `serial_wus` int(11) NOT NULL AUTO_INCREMENT,
  `id_wus` varchar(13) NOT NULL,
  `first_name_wus` varchar(512) NOT NULL,
  `last_name_wus` varchar(512) NOT NULL,
  `birthdate_wus` date NOT NULL,
  `gender_wus` enum('MALE','FEMALE') NOT NULL,
  `address_wus` text NOT NULL,
  `phone_wus` varchar(30) NOT NULL,
  `status_wus` enum('ACTIVE','INACTIVE','PENDING','BLOCKED') NOT NULL DEFAULT 'PENDING',
  `occupation_wus` varchar(50) DEFAULT NULL,
  `company_name_wus` varchar(100) DEFAULT NULL,
  `company_activity_wus` varchar(80) DEFAULT NULL,
  `company_phone_wus` varchar(13) DEFAULT NULL,
  `email_wus` varchar(128) NOT NULL,
  `password_wus` varchar(256) NOT NULL,
  `authentication_key_wus` varchar(1024) NOT NULL,
  PRIMARY KEY (`serial_wus`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_concept_taxes`
--

CREATE TABLE IF NOT EXISTS `year_concept_taxes` (
  `serial_ypc` int(11) DEFAULT NULL,
  `serial_tax` int(11) DEFAULT NULL,
  `value_yct` decimal(5,2) DEFAULT NULL,
  `status_yct` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  `serial_pct` int(11) DEFAULT NULL,
  KEY `fk_relationship_93` (`serial_tax`),
  KEY `fk_relationship_94` (`serial_ypc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `year_discount`
--

CREATE TABLE IF NOT EXISTS `year_discount` (
  `serial_ydc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_dsc` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `type_ydc` enum('PERCENTAGE','FIXED') NOT NULL,
  `value_ydc` decimal(10,2) NOT NULL,
  `days_before_limit_ydc` int(11) DEFAULT NULL,
  `status_ydc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ydc`),
  KEY `fk_relationship_224` (`serial_scy`),
  KEY `fk_relationship_225` (`serial_dsc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_grade_subject`
--

CREATE TABLE IF NOT EXISTS `year_grade_subject` (
  `serial_ygs` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_csb` int(11) DEFAULT NULL,
  `status_ygs` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ygs`),
  KEY `fk_relationship_174` (`serial_csb`),
  KEY `fk_relationship_175` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_level_specialty_payment_concept`
--

CREATE TABLE IF NOT EXISTS `year_level_specialty_payment_concept` (
  `serial_ypc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_art` int(11) DEFAULT NULL,
  `serial_pct` int(11) NOT NULL,
  `serial_spt` int(11) NOT NULL,
  `serial_lvl` int(11) NOT NULL,
  `serial_scy` int(11) NOT NULL,
  `serial_set` int(11) NOT NULL,
  `value_ypc` decimal(10,2) NOT NULL,
  `frequency_ypc` enum('ANNUAL','MONTHLY') NOT NULL,
  `repetitions_number_ypc` int(11) NOT NULL,
  `enabling_concept_ypc` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `mandatory_ypc` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `student_type_ypc` enum('NEW','OLD','BOTH') NOT NULL DEFAULT 'BOTH',
  `type_ypc` enum('ACADEMIC','NON_ACADEMIC') NOT NULL DEFAULT 'ACADEMIC',
  `status_ypc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ypc`),
  KEY `fk_relationship_90` (`serial_spt`,`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_91` (`serial_pct`),
  KEY `fk_relationship_92` (`serial_art`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_pre_registration_document`
--

CREATE TABLE IF NOT EXISTS `year_pre_registration_document` (
  `serial_ypd` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_qdc` int(11) DEFAULT NULL,
  `status_ypd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ypd`),
  KEY `fk_relationship_261` (`serial_scy`),
  KEY `fk_relationship_262` (`serial_qdc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_qualifying_document`
--

CREATE TABLE IF NOT EXISTS `year_qualifying_document` (
  `serial_yqd` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_qdc` int(11) DEFAULT NULL,
  `status_yqd` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_yqd`),
  KEY `fk_relationship_157` (`serial_scy`),
  KEY `fk_relationship_158` (`serial_qdc`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_report_comment`
--

CREATE TABLE IF NOT EXISTS `year_report_comment` (
  `serial_yrc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `report_type_yrc` enum('SCY_RESIT_GRADE','MIN_PERIOD_GRADE','MIN_FINAL_GRADE','MIN_GRADE_SCORE','MIN_RESIT_GRADE') NOT NULL,
  `remote_id_yrc` int(11) DEFAULT NULL,
  `comment_yrc` text NOT NULL,
  PRIMARY KEY (`serial_yrc`),
  KEY `fk_relationship_259` (`serial_std`),
  KEY `fk_relationship_260` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_resit_exam_ranges`
--

CREATE TABLE IF NOT EXISTS `year_resit_exam_ranges` (
  `serial_yre` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `lower_limit_yre` decimal(5,2) NOT NULL,
  `higher_limit_yre` decimal(5,2) NOT NULL,
  `required_grade_yre` decimal(8,5) NOT NULL,
  `type_yre` enum('SCHOOL','MINISTRY') NOT NULL DEFAULT 'SCHOOL',
  `status_yre` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_yre`),
  KEY `fk_relationship_162` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_special_grade`
--

CREATE TABLE IF NOT EXISTS `year_special_grade` (
  `serial_ysg` int(11) NOT NULL AUTO_INCREMENT,
  `serial_scy` int(11) DEFAULT NULL,
  `name_ysg` varchar(256) NOT NULL,
  `description_ysg` text NOT NULL,
  `status_ysg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ysg`),
  KEY `fk_relationship_178` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_subject_classroom`
--

CREATE TABLE IF NOT EXISTS `year_subject_classroom` (
  `serial_ysc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_clr` int(11) DEFAULT NULL,
  `serial_osb` int(11) DEFAULT NULL,
  `status_ysc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ysc`),
  KEY `fk_relationship_163` (`serial_clr`),
  KEY `fk_relationship_164` (`serial_sbc`),
  KEY `fk_relationship_165` (`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `autoschedule_process`
--

CREATE TABLE IF NOT EXISTS `autoschedule_process` (
  `serial_asp` int(11) NOT NULL AUTO_INCREMENT,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `date_asp` timestamp NULL,
  `status_asp` enum('PENDING','PROGRESS','DONE') NOT NULL DEFAULT 'PENDING',
  `desired_opt_asp` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`serial_asp`),
  KEY `fk_relationship_293` (`serial_usr`),
  KEY `fk_relationship_294` (`serial_scy`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `autoschedule_process_results`
--

CREATE TABLE IF NOT EXISTS `autoschedule_process_results` (
  `serial_asr` int(11) NOT NULL AUTO_INCREMENT,
  `serial_emp` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_crs` int(11) DEFAULT NULL,
  `serial_cdt` int(11) DEFAULT NULL,
  `serial_asp` int(11) DEFAULT NULL,
  `serial_clr` int(11) DEFAULT NULL,
  `serial_lop` int(11) DEFAULT NULL,
  `option_asr` int(11) NOT NULL,
  `day_asr` enum('MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY') NOT NULL,
  PRIMARY KEY (`serial_asr`),
  KEY `fk_relationship_295` (`serial_asp`),
  KEY `fk_relationship_296` (`serial_lop`),
  KEY `fk_relationship_297` (`serial_sbc`),
  KEY `fk_relationship_298` (`serial_clr`),
  KEY `fk_relationship_299` (`serial_crs`),
  KEY `fk_relationship_300` (`serial_emp`),
  KEY `fk_relationship_301` (`serial_cdt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `period_exam_grade_change_log`
--

CREATE TABLE IF NOT EXISTS `period_exam_grade_change_log` (
  `serial_usr` int(11) DEFAULT NULL,
  `serial_chr` int(11) DEFAULT NULL,
  `serial_spx` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `change_date_sxc` date NOT NULL,
  `last_grade_sxc` decimal(8,5) DEFAULT NULL,
  `comment_sxc` text,
  KEY `fk_relationship_310` (`serial_spx`,`serial_std`),
  KEY `fk_relationship_311` (`serial_usr`),
  KEY `fk_relationship_312` (`serial_chr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `student_period_comment`
--

CREATE TABLE IF NOT EXISTS `student_period_comment` (
  `serial_std` int(11) DEFAULT NULL,
  `serial_prd` int(11) DEFAULT NULL,
  `comment_spc` text NOT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_crs` int(11) DEFAULT NULL,
  KEY `fk_relationship_315` (`serial_usr`,`serial_crs`),
  KEY `fk_relationship_316` (`serial_prd`),
  KEY `fk_relationship_318` (`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;



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

--
-- Estructura de tabla para la tabla `student_period_exam`
--

CREATE TABLE IF NOT EXISTS `student_period_exam` (
  `serial_spx` int(11) NOT NULL,
  `serial_std` int(11) NOT NULL,
  `grade_stx` decimal(8,5) DEFAULT NULL,
  `status_stx` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_spx`,`serial_std`),
  KEY `fk_relationship_309` (`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


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

--
-- Estructura de tabla para la tabla `subject_period_exam`
--

CREATE TABLE IF NOT EXISTS `subject_period_exam` (
  `serial_spx` int(11) NOT NULL AUTO_INCREMENT,
  `serial_sbc` int(11) DEFAULT NULL,
  `serial_osb` int(11) DEFAULT NULL,
  `serial_ype` int(11) DEFAULT NULL,
  `status_spx` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_spx`),
  KEY `fk_relationship_305` (`serial_ype`),
  KEY `fk_relationship_306` (`serial_sbc`),
  KEY `fk_relationship_307` (`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `subperiod`
--

CREATE TABLE IF NOT EXISTS `subperiod` (
  `serial_sbp` int(11) NOT NULL AUTO_INCREMENT,
  `serial_prd` int(11) DEFAULT NULL,
  `name_sbp` varchar(128) NOT NULL,
  `start_date_sbp` date NOT NULL,
  `end_date_sbp` date NOT NULL,
  `status_sbp` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_sbp`),
  KEY `fk_relationship_302` (`serial_prd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `user_course_comment_setup`
--

CREATE TABLE IF NOT EXISTS `user_course_comment_setup` (
  `serial_usr` int(11) NOT NULL,
  `serial_crs` int(11) NOT NULL,
  `status_cpc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_usr`,`serial_crs`),
  KEY `fk_relationship_314` (`serial_crs`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `year_period_exam_setup`
--

CREATE TABLE IF NOT EXISTS `year_period_exam_setup` (
  `serial_ype` int(11) NOT NULL AUTO_INCREMENT,
  `serial_prd` int(11) DEFAULT NULL,
  `serial_lvl` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_set` int(11) DEFAULT NULL,
  `description_ype` text NOT NULL,
  `weight_ype` decimal(8,5) NOT NULL,
  `status_ype` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ype`),
  KEY `fk_relationship_303` (`serial_lvl`,`serial_scy`,`serial_set`),
  KEY `fk_relationship_304` (`serial_prd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `skills`
--

CREATE TABLE IF NOT EXISTS `skills` (
  `serial_skl` int(11) NOT NULL AUTO_INCREMENT,
  `description_skl` text NOT NULL,
  `status_skl` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_skl`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `year_subject_skills`
--

CREATE TABLE IF NOT EXISTS `year_subject_skills` (
  `serial_yss` int(11) NOT NULL AUTO_INCREMENT,
  `serial_osb` int(11) DEFAULT NULL,
  `serial_skl` int(11) DEFAULT NULL,
  `serial_sbc` int(11) DEFAULT NULL,
  `status_yss` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_yss`),
  KEY `fk_relationship_320` (`serial_skl`),
  KEY `fk_relationship_321` (`serial_sbc`),
  KEY `fk_relationship_322` (`serial_osb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `level_skill_grade_criteria`
--

CREATE TABLE IF NOT EXISTS `level_skill_grade_criteria` (
  `serial_lsc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_lvl` int(11) DEFAULT NULL,
  `serial_scy` int(11) DEFAULT NULL,
  `serial_set` int(11) DEFAULT NULL,
  `abbreviation_lsc` varchar(5) NOT NULL,
  `description_lsc` varchar(50) NOT NULL,
  `status_lsc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_lsc`),
  KEY `fk_relationship_317` (`serial_lvl`,`serial_scy`,`serial_set`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `level_opt_skill_criteria`
--

CREATE TABLE IF NOT EXISTS `level_opt_skill_criteria` (
  `serial_osc` int(11) NOT NULL AUTO_INCREMENT,
  `serial_lop` int(11) DEFAULT NULL,
  `abbreviation_osc` varchar(5) NOT NULL,
  `description_osc` varchar(50) NOT NULL,
  `status_osc` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_osc`),
  KEY `fk_relationship_319` (`serial_lop`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `student_period_subject_skill_grade`
--

CREATE TABLE IF NOT EXISTS `student_period_subject_skill_grade` (
  `serial_ssg` int(11) NOT NULL AUTO_INCREMENT,
  `serial_osc` int(11) DEFAULT NULL,
  `serial_yss` int(11) DEFAULT NULL,
  `serial_std` int(11) DEFAULT NULL,
  `serial_prd` int(11) DEFAULT NULL,
  `serial_lsc` int(11) DEFAULT NULL,
  `status_ssg` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ssg`),
  KEY `fk_relationship_323` (`serial_prd`),
  KEY `fk_relationship_324` (`serial_yss`),
  KEY `fk_relationship_325` (`serial_osc`),
  KEY `fk_relationship_326` (`serial_lsc`),
  KEY `fk_relationship_327` (`serial_std`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


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

--
-- Estructura de tabla para la tabla `invoice_detail_non_academic`
--

CREATE TABLE IF NOT EXISTS `invoice_detail_non_academic` (
  `serial_sva` int(11) DEFAULT NULL,
  `serial_cdf` int(11) DEFAULT NULL,
  `serial_ina` int(11) DEFAULT NULL,
  `serial_deb` int(11) DEFAULT NULL,
  `status_idn` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_328` (`serial_ina`),
  KEY `fk_relationship_329` (`serial_deb`),
  KEY `fk_relationship_330` (`serial_sva`),
  KEY `fk_relationship_331` (`serial_cdf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `invoice_non_academic`
--

CREATE TABLE IF NOT EXISTS `invoice_non_academic` (
  `serial_ina` int(11) NOT NULL AUTO_INCREMENT,
  `payment_date_ina` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `subtotal_ina` decimal(10,2) NOT NULL,
  `taxes_ina` decimal(10,2) NOT NULL,
  `total_ina` decimal(10,2) NOT NULL,
  `id_paying_ina` varchar(15) DEFAULT NULL,
  `name_paying_ina` varchar(512) DEFAULT NULL,
  `phone_paying_ina` varchar(30) DEFAULT NULL,
  `address_paying_ina` varchar(1024) DEFAULT NULL,
  `physical_number_ina` varchar(128) DEFAULT NULL,
  `month_ina` varchar(3) NOT NULL,
  `due_date_ina` date NOT NULL,
  `status_ina` enum('ACTIVE','INACTIVE','VOID','PAID') NOT NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ina`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


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

--
-- Estructura de tabla para la tabla `payment_detail_non_academic`
--

CREATE TABLE IF NOT EXISTS `payment_detail_non_academic` (
  `serial_ina` int(11) DEFAULT NULL,
  `serial_fin` int(11) DEFAULT NULL,
  `serial_usr` int(11) DEFAULT NULL,
  `serial_ccd` int(11) DEFAULT NULL,
  `serial_pym` int(11) DEFAULT NULL,
  `description_pdn` varchar(128) NOT NULL,
  `document_number_pdn` varchar(128) DEFAULT NULL,
  `amount_pdn` decimal(10,2) NOT NULL,
  `kinship_pdn` varchar(80) DEFAULT NULL,
  `owner_pdn` varchar(300) DEFAULT NULL,
  `date_pdn` date DEFAULT NULL,
  `status_pdn` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
  KEY `fk_relationship_332` (`serial_ina`),
  KEY `fk_relationship_333` (`serial_fin`),
  KEY `fk_relationship_334` (`serial_ccd`),
  KEY `fk_relationship_335` (`serial_pym`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;




--
-- Filtros para las tablas descargadas (dump)
--


--
-- Filtros para la tabla `payment_detail_non_academic`
--
ALTER TABLE `payment_detail_non_academic`
  ADD CONSTRAINT `fk_relationship_335` FOREIGN KEY (`serial_pym`) REFERENCES `payment_method` (`serial_pym`),
  ADD CONSTRAINT `fk_relationship_332` FOREIGN KEY (`serial_ina`) REFERENCES `invoice_non_academic` (`serial_ina`),
  ADD CONSTRAINT `fk_relationship_333` FOREIGN KEY (`serial_fin`) REFERENCES `financial_institution` (`serial_fin`),
  ADD CONSTRAINT `fk_relationship_341` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_334` FOREIGN KEY (`serial_ccd`) REFERENCES `credit_card` (`serial_ccd`);


--
-- Filtros para la tabla `invoice_detail_non_academic`
--
ALTER TABLE `invoice_detail_non_academic`
  ADD CONSTRAINT `fk_relationship_331` FOREIGN KEY (`serial_cdf`) REFERENCES `current_deferred` (`serial_cdf`),
  ADD CONSTRAINT `fk_relationship_328` FOREIGN KEY (`serial_ina`) REFERENCES `invoice_non_academic` (`serial_ina`),
  ADD CONSTRAINT `fk_relationship_329` FOREIGN KEY (`serial_deb`) REFERENCES `student_year_debts` (`serial_deb`),
  ADD CONSTRAINT `fk_relationship_330` FOREIGN KEY (`serial_sva`) REFERENCES `student_year_discount_values` (`serial_sva`);


--
-- Filtros para la tabla `access_log`
--
ALTER TABLE `access_log`
  ADD CONSTRAINT `fk_relationship_143` FOREIGN KEY (`serial_usr`, `serial_prf`) REFERENCES `user_profile` (`serial_usr`, `serial_prf`);

--
-- Filtros para la tabla `activity_applied_criterias`
--
ALTER TABLE `activity_applied_criterias`
  ADD CONSTRAINT `fk_relationship_95` FOREIGN KEY (`serial_att`, `serial_prd`, `serial_sbc`, `serial_sbj`, `serial_gct`) REFERENCES `subject_year_activity_criteria_period` (`serial_att`, `serial_prd`, `serial_sbc`, `serial_sbj`, `serial_gct`),
  ADD CONSTRAINT `fk_activity_header` FOREIGN KEY (`serial_act`) REFERENCES `activity` (`serial_act`);

--
-- Filtros para la tabla `activity_attachment`
--
ALTER TABLE `activity_attachment`
  ADD CONSTRAINT `fk_relationship_96` FOREIGN KEY (`serial_act`) REFERENCES `activity` (`serial_act`);

--
-- Filtros para la tabla `activity_policy_violations`
--
ALTER TABLE `activity_policy_violations`
  ADD CONSTRAINT `fk_relationship_148` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`),
  ADD CONSTRAINT `fk_relationship_146` FOREIGN KEY (`serial_act`) REFERENCES `activity` (`serial_act`),
  ADD CONSTRAINT `fk_relationship_147` FOREIGN KEY (`serial_opa`) REFERENCES `opt_activity` (`serial_opa`);

--
-- Filtros para la tabla `allowed_pages_by_process`
--
ALTER TABLE `allowed_pages_by_process`
  ADD CONSTRAINT `fk_child_pages` FOREIGN KEY (`serial_prc`) REFERENCES `process` (`serial_prc`);

--
-- Filtros para la tabla `attendance`
--
ALTER TABLE `attendance`
  ADD CONSTRAINT `fk_relationship_290` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_289` FOREIGN KEY (`serial_scd`) REFERENCES `schedule` (`serial_scd`);

--
-- Filtros para la tabla `authority`
--
ALTER TABLE `authority`
  ADD CONSTRAINT `fk_has_charge` FOREIGN KEY (`serial_atc`) REFERENCES `authority_charge` (`serial_atc`);

--
-- Filtros para la tabla `book`
--
ALTER TABLE `book`
  ADD CONSTRAINT `fk_relationship_272` FOREIGN KEY (`serial_lst`) REFERENCES `library_section` (`serial_lst`),
  ADD CONSTRAINT `fk_relationship_271` FOREIGN KEY (`serial_bct`) REFERENCES `book_category` (`serial_bct`);

--
-- Filtros para la tabla `book_author`
--
ALTER TABLE `book_author`
  ADD CONSTRAINT `fk_relationship_274` FOREIGN KEY (`serial_bok`) REFERENCES `book` (`serial_bok`),
  ADD CONSTRAINT `fk_relationship_273` FOREIGN KEY (`serial_atr`) REFERENCES `author` (`serial_atr`);

--
-- Filtros para la tabla `book_category`
--
ALTER TABLE `book_category`
  ADD CONSTRAINT `fk_relationship_270` FOREIGN KEY (`boo_serial_bct`) REFERENCES `book_category` (`serial_bct`);

--
-- Filtros para la tabla `book_copy`
--
ALTER TABLE `book_copy`
  ADD CONSTRAINT `fk_relationship_275` FOREIGN KEY (`serial_bok`) REFERENCES `book` (`serial_bok`);

--
-- Filtros para la tabla `bus_shift_year`
--
ALTER TABLE `bus_shift_year`
  ADD CONSTRAINT `fk_relationship_81` FOREIGN KEY (`bus_serial_bdr`) REFERENCES `bus_driver` (`serial_bdr`),
  ADD CONSTRAINT `fk_relationship_76` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`),
  ADD CONSTRAINT `fk_relationship_77` FOREIGN KEY (`serial_bdr`) REFERENCES `bus_driver` (`serial_bdr`),
  ADD CONSTRAINT `fk_relationship_78` FOREIGN KEY (`serial_bus`) REFERENCES `bus` (`serial_bus`),
  ADD CONSTRAINT `fk_relationship_79` FOREIGN KEY (`serial_rot`) REFERENCES `route` (`serial_rot`),
  ADD CONSTRAINT `fk_relationship_80` FOREIGN KEY (`serial_sft`) REFERENCES `shift` (`serial_sft`);

--
-- Filtros para la tabla `bus_year_user`
--
ALTER TABLE `bus_year_user`
  ADD CONSTRAINT `fk_relationship_98` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_97` FOREIGN KEY (`serial_rot`, `serial_scy`, `serial_bus`, `serial_sft`) REFERENCES `bus_shift_year` (`serial_rot`, `serial_scy`, `serial_bus`, `serial_sft`);

--
-- Filtros para la tabla `cat_subject`
--
ALTER TABLE `cat_subject`
  ADD CONSTRAINT `fk_relationship_68` FOREIGN KEY (`serial_lng`) REFERENCES `language` (`serial_lng`),
  ADD CONSTRAINT `fk_child_parent` FOREIGN KEY (`cat_serial_csb`) REFERENCES `cat_subject` (`serial_csb`),
  ADD CONSTRAINT `fk_relationship_62` FOREIGN KEY (`serial_aca`) REFERENCES `academic_area` (`serial_aca`);

--
-- Filtros para la tabla `course`
--
ALTER TABLE `course`
  ADD CONSTRAINT `fk_selected_level_speciality` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_selected_class` FOREIGN KEY (`serial_clg`) REFERENCES `class_group` (`serial_clg`);

--
-- Filtros para la tabla `course_director`
--
ALTER TABLE `course_director`
  ADD CONSTRAINT `fk_relationship_145` FOREIGN KEY (`serial_crs`) REFERENCES `course` (`serial_crs`),
  ADD CONSTRAINT `fk_relationship_144` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`);

--
-- Filtros para la tabla `credits_detail`
--
ALTER TABLE `credits_detail`
  ADD CONSTRAINT `fk_relationship_269` FOREIGN KEY (`serial_hrs`) REFERENCES `hour` (`serial_hrs`);

--
-- Filtros para la tabla `current_deferred`
--
ALTER TABLE `current_deferred`
  ADD CONSTRAINT `fk_relationship_338` FOREIGN KEY (`serial_fic`) REFERENCES `financial_institution_card` (`serial_fic`),
  ADD CONSTRAINT `fk_relationship_340` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `discipline`
--
ALTER TABLE `discipline`
  ADD CONSTRAINT `fk_relationship_131` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`),
  ADD CONSTRAINT `fk_relationship_130` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `discount_payment_concept`
--
ALTER TABLE `discount_payment_concept`
  ADD CONSTRAINT `fk_relationship_227` FOREIGN KEY (`serial_pct`) REFERENCES `payment_concept` (`serial_pct`),
  ADD CONSTRAINT `fk_relationship_226` FOREIGN KEY (`serial_ydc`) REFERENCES `year_discount` (`serial_ydc`);

--
-- Filtros para la tabla `employee`
--
ALTER TABLE `employee`
  ADD CONSTRAINT `fk_relationship_60` FOREIGN KEY (`serial_unv`) REFERENCES `university` (`serial_unv`),
  ADD CONSTRAINT `fk_employee_birth_country` FOREIGN KEY (`serial_cou`) REFERENCES `country` (`serial_cou`),
  ADD CONSTRAINT `fk_employee_birth_state` FOREIGN KEY (`serial_ste`) REFERENCES `state` (`serial_ste`),
  ADD CONSTRAINT `fk_employee_guardian2` FOREIGN KEY (`serial_grd`) REFERENCES `guardian` (`serial_grd`),
  ADD CONSTRAINT `fk_employee_user` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_54` FOREIGN KEY (`serial_nnt`) REFERENCES `nationality` (`serial_nnt`),
  ADD CONSTRAINT `fk_relationship_55` FOREIGN KEY (`serial_tdg`) REFERENCES `teacher_degree` (`serial_tdg`),
  ADD CONSTRAINT `fk_relationship_56` FOREIGN KEY (`serial_tmd`) REFERENCES `teacher_master_degree` (`serial_tmd`),
  ADD CONSTRAINT `fk_relationship_57` FOREIGN KEY (`serial_tst`) REFERENCES `teacher_specialty` (`serial_tst`),
  ADD CONSTRAINT `fk_relationship_58` FOREIGN KEY (`serial_dgr`) REFERENCES `degree` (`serial_dgr`),
  ADD CONSTRAINT `fk_relationship_59` FOREIGN KEY (`serial_mdg`) REFERENCES `master_degree` (`serial_mdg`);

--
-- Filtros para la tabla `employee_area`
--
ALTER TABLE `employee_area`
  ADD CONSTRAINT `fk_employee_in_area` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`),
  ADD CONSTRAINT `fk_area_by_employee` FOREIGN KEY (`serial_aca`) REFERENCES `academic_area` (`serial_aca`);

--
-- Filtros para la tabla `general_activity_attendees`
--
ALTER TABLE `general_activity_attendees`
  ADD CONSTRAINT `fk_relationship_140` FOREIGN KEY (`serial_gac`) REFERENCES `general_activity` (`serial_gac`),
  ADD CONSTRAINT `fk_relationship_139` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);
  
--
-- Filtros para la tabla `general_activity_attendees`
--
ALTER TABLE `financial_institution_card`
  ADD CONSTRAINT `fk_relationship_336` FOREIGN KEY (`serial_ccd`) REFERENCES `credit_card` (`serial_ccd`),
  ADD CONSTRAINT `fk_relationship_337` FOREIGN KEY (`serial_fin`) REFERENCES `financial_institution` (`serial_fin`);

--
-- Filtros para la tabla `general_discipline_log`
--
ALTER TABLE `general_discipline_log`
  ADD CONSTRAINT `fk_relationship_153` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`),
  ADD CONSTRAINT `fk_relationship_151` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_152` FOREIGN KEY (`serial_prd`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `discipline` (`serial_prd`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `grade_change_log`
--

ALTER TABLE `grade_change_log`
  ADD CONSTRAINT `fk_relationship_150` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`),
  ADD CONSTRAINT `fk_relationship_123` FOREIGN KEY (`serial_sbc`, `serial_att`, `serial_prd`, `serial_gct`, `serial_act`, `serial_std`, `serial_crs`) REFERENCES `student_criteria_grade` (`serial_sbc`, `serial_att`, `serial_prd`, `serial_gct`, `serial_act`, `serial_std`, `serial_crs`),
  ADD CONSTRAINT `fk_relationship_124` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `grade_score_change_log`
--
ALTER TABLE `grade_score_change_log`
  ADD CONSTRAINT `fk_relationship_239` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_237` FOREIGN KEY (`serial_ygs`, `serial_std`) REFERENCES `grade_subject_score` (`serial_ygs`, `serial_std`),
  ADD CONSTRAINT `fk_relationship_238` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`);

--
-- Filtros para la tabla `grade_subject_score`
--
ALTER TABLE `grade_subject_score`
  ADD CONSTRAINT `fk_relationship_177` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_176` FOREIGN KEY (`serial_ygs`) REFERENCES `year_grade_subject` (`serial_ygs`);

--
-- Filtros para la tabla `group_hour_level`
--
ALTER TABLE `group_hour_level`
  ADD CONSTRAINT `fk_levels_in_group_hour` FOREIGN KEY (`serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year` (`serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_group_hour_for_level` FOREIGN KEY (`serial_gph`) REFERENCES `group_hour` (`serial_gph`);

--
-- Filtros para la tabla `group_optional_subject`
--
ALTER TABLE `group_optional_subject`
  ADD CONSTRAINT `fk_relationship_282` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`),
  ADD CONSTRAINT `fk_relationship_281` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`);

--
-- Filtros para la tabla `guardian`
--
ALTER TABLE `guardian`
  ADD CONSTRAINT `fk_guardian_user` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_employee_guardian` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`);

--
-- Filtros para la tabla `hour_by_group`
--
ALTER TABLE `hour_by_group`
  ADD CONSTRAINT `fk_is_in_group` FOREIGN KEY (`serial_hrs`) REFERENCES `hour` (`serial_hrs`),
  ADD CONSTRAINT `fk_for_group` FOREIGN KEY (`serial_gph`) REFERENCES `group_hour` (`serial_gph`);

--
-- Filtros para la tabla `incident`
--
ALTER TABLE `incident`
  ADD CONSTRAINT `fk_relationship_195` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_194` FOREIGN KEY (`use_serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `income_stock`
--
ALTER TABLE `income_stock`
  ADD CONSTRAINT `fk_relationship_186` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_184` FOREIGN KEY (`serial_prv`) REFERENCES `provider` (`serial_prv`),
  ADD CONSTRAINT `fk_relationship_185` FOREIGN KEY (`serial_mti`) REFERENCES `maintenance_item` (`serial_mti`);

--
-- Filtros para la tabla `invoice_detail`
--
ALTER TABLE `invoice_detail`
  ADD CONSTRAINT `fk_relationship_231` FOREIGN KEY (`serial_sva`) REFERENCES `student_year_discount_values` (`serial_sva`),
  ADD CONSTRAINT `fk_relationship_155` FOREIGN KEY (`serial_phy`) REFERENCES `invoice` (`serial_phy`),
  ADD CONSTRAINT `fk_relationship_156` FOREIGN KEY (`serial_deb`) REFERENCES `student_year_debts` (`serial_deb`),
  ADD CONSTRAINT `fk_relationship_171` FOREIGN KEY (`serial_cdf`) REFERENCES `current_deferred` (`serial_cdf`);

--
-- Filtros para la tabla `level_optional_group`
--
ALTER TABLE `level_optional_group`
  ADD CONSTRAINT `fk_relationship_243` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `level_optional_group_detail`
--
ALTER TABLE `level_optional_group_detail`
  ADD CONSTRAINT `fk_relationship_245` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`),
  ADD CONSTRAINT `fk_relationship_244` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`);

--
-- Filtros para la tabla `level_section_year`
--
ALTER TABLE `level_section_year`
  ADD CONSTRAINT `fk_section_for_level` FOREIGN KEY (`serial_scy`, `serial_set`) REFERENCES `section_by_year` (`serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_level_in_section` FOREIGN KEY (`serial_lvl`) REFERENCES `level` (`serial_lvl`),
  ADD CONSTRAINT `fk_period_group_level` FOREIGN KEY (`serial_pgy`) REFERENCES `period_group_year` (`serial_pgy`);

--
-- Filtros para la tabla `level_section_year_specialty`
--
ALTER TABLE `level_section_year_specialty`
  ADD CONSTRAINT `fk_selected_specialty` FOREIGN KEY (`serial_spt`) REFERENCES `specialty` (`serial_spt`),
  ADD CONSTRAINT `fk_selected_level` FOREIGN KEY (`serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year` (`serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `loan`
--
ALTER TABLE `loan`
  ADD CONSTRAINT `fk_relationship_280` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `loan_detail`
--
ALTER TABLE `loan_detail`
  ADD CONSTRAINT `fk_relationship_279` FOREIGN KEY (`serial_loa`) REFERENCES `loan` (`serial_loa`),
  ADD CONSTRAINT `fk_relationship_276` FOREIGN KEY (`serial_eqt`) REFERENCES `equipment` (`serial_eqt`),
  ADD CONSTRAINT `fk_relationship_277` FOREIGN KEY (`serial_stp`) REFERENCES `study_place` (`serial_stp`),
  ADD CONSTRAINT `fk_relationship_278` FOREIGN KEY (`serial_bkc`) REFERENCES `book_copy` (`serial_bkc`);

--
-- Filtros para la tabla `maintenance_item`
--
ALTER TABLE `maintenance_item`
  ADD CONSTRAINT `fk_relationship_183` FOREIGN KEY (`serial_ict`) REFERENCES `item_category` (`serial_ict`);

--
-- Filtros para la tabla `medical_file`
--
ALTER TABLE `medical_file`
  ADD CONSTRAINT `fk_relationship_65` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_196` FOREIGN KEY (`serial_gst`) REFERENCES `guest` (`serial_gst`);

--
-- Filtros para la tabla `message`
--
ALTER TABLE `message`
  ADD CONSTRAINT `fk_relationship_154` FOREIGN KEY (`serial_prf`) REFERENCES `profile` (`serial_prf`),
  ADD CONSTRAINT `fk_relationship_136` FOREIGN KEY (`serial_usr_send`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_137` FOREIGN KEY (`serial_usr_receive`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `message_between_profiles`
--
ALTER TABLE `message_between_profiles`
  ADD CONSTRAINT `fk_relationship_142` FOREIGN KEY (`pro_serial_prf`) REFERENCES `profile` (`serial_prf`),
  ADD CONSTRAINT `fk_relationship_141` FOREIGN KEY (`serial_prf`) REFERENCES `profile` (`serial_prf`);

--
-- Filtros para la tabla `message_thread`
--
ALTER TABLE `message_thread`
  ADD CONSTRAINT `fk_relationship_138` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `message_thread_messages`
--
ALTER TABLE `message_thread_messages`
  ADD CONSTRAINT `fk_relationship_135` FOREIGN KEY (`serial_msg`) REFERENCES `message` (`serial_msg`),
  ADD CONSTRAINT `fk_relationship_134` FOREIGN KEY (`serial_mth`) REFERENCES `message_thread` (`serial_mth`);

--
-- Filtros para la tabla `ministry_resit_change_log`
--
ALTER TABLE `ministry_resit_change_log`
  ADD CONSTRAINT `fk_relationship_258` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`),
  ADD CONSTRAINT `fk_relationship_254` FOREIGN KEY (`serial_msb`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `ministry_resit_student` (`serial_msb`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_257` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `ministry_resit_student`
--
ALTER TABLE `ministry_resit_student`
  ADD CONSTRAINT `fk_relationship_256` FOREIGN KEY (`serial_msb`) REFERENCES `ministry_subject` (`serial_msb`),
  ADD CONSTRAINT `fk_relationship_255` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `optional_subject`
--
ALTER TABLE `optional_subject`
  ADD CONSTRAINT `fk_relationship_53` FOREIGN KEY (`serial_csb`) REFERENCES `cat_subject` (`serial_csb`),
  ADD CONSTRAINT `fk_relationship_116` FOREIGN KEY (`per_serial_pgy`) REFERENCES `period_group_year` (`serial_pgy`),
  ADD CONSTRAINT `fk_relationship_127` FOREIGN KEY (`serial_aca`, `serial_emp`) REFERENCES `employee_area` (`serial_aca`, `serial_emp`),
  ADD CONSTRAINT `fk_relationship_249` FOREIGN KEY (`serial_pgy`) REFERENCES `period_group_year` (`serial_pgy`);

--
-- Filtros para la tabla `optional_subject_level`
--
ALTER TABLE `optional_subject_level`
  ADD CONSTRAINT `fk_relationship_105` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`),
  ADD CONSTRAINT `fk_relationship_104` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `optional_subject_period`
--
ALTER TABLE `optional_subject_period`
  ADD CONSTRAINT `fk_relationship_107` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`),
  ADD CONSTRAINT `fk_relationship_106` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`);

--
-- Filtros para la tabla `optional_subject_retest`
--
ALTER TABLE `optional_subject_retest`
  ADD CONSTRAINT `fk_relationship_198` FOREIGN KEY (`serial_prd`, `serial_osb`) REFERENCES `optional_subject_period` (`serial_prd`, `serial_osb`);

--
-- Filtros para la tabla `optional_subject_retest_student`
--
ALTER TABLE `optional_subject_retest_student`
  ADD CONSTRAINT `fk_relationship_200` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_199` FOREIGN KEY (`serial_osr`) REFERENCES `optional_subject_retest` (`serial_osr`);

--
-- Filtros para la tabla `opt_activity_applied_criterias`
--
ALTER TABLE `opt_activity_applied_criterias`
  ADD CONSTRAINT `fk_relationship_118` FOREIGN KEY (`serial_opa`) REFERENCES `opt_activity` (`serial_opa`),
  ADD CONSTRAINT `fk_relationship_117` FOREIGN KEY (`serial_gct`, `serial_osb`, `serial_att`, `serial_prd`) REFERENCES `opt_subject_year_activity_criteria_period` (`serial_gct`, `serial_osb`, `serial_att`, `serial_prd`);

--
-- Filtros para la tabla `opt_activity_attachment`
--
ALTER TABLE `opt_activity_attachment`
  ADD CONSTRAINT `fk_relationship_119` FOREIGN KEY (`serial_opa`) REFERENCES `opt_activity` (`serial_opa`);

--
-- Filtros para la tabla `opt_grade_change_log`
--
ALTER TABLE `opt_grade_change_log`
  ADD CONSTRAINT `fk_relationship_149` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`),
  ADD CONSTRAINT `fk_relationship_125` FOREIGN KEY (`serial_opa`, `serial_gct`, `serial_osb`, `serial_att`, `serial_prd`, `serial_std`) REFERENCES `opt_student_criteria_grade` (`serial_opa`, `serial_gct`, `serial_osb`, `serial_att`, `serial_prd`, `serial_std`),
  ADD CONSTRAINT `fk_relationship_126` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `opt_student_criteria_grade`
--
ALTER TABLE `opt_student_criteria_grade`
  ADD CONSTRAINT `fk_relationship_121` FOREIGN KEY (`serial_opa`, `serial_gct`, `serial_osb`, `serial_att`, `serial_prd`) REFERENCES `opt_activity_applied_criterias` (`serial_opa`, `serial_gct`, `serial_osb`, `serial_att`, `serial_prd`);

--
-- Filtros para la tabla `opt_subject_period_activity_type`
--
ALTER TABLE `opt_subject_period_activity_type`
  ADD CONSTRAINT `fk_relationship_113` FOREIGN KEY (`serial_att`) REFERENCES `activity_type` (`serial_att`),
  ADD CONSTRAINT `fk_relationship_112` FOREIGN KEY (`serial_prd`, `serial_osb`) REFERENCES `optional_subject_period` (`serial_prd`, `serial_osb`);

--
-- Filtros para la tabla `opt_subject_retest_change_log`
--
ALTER TABLE `opt_subject_retest_change_log`
  ADD CONSTRAINT `fk_relationship_217` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`),
  ADD CONSTRAINT `fk_relationship_215` FOREIGN KEY (`serial_std`, `serial_osr`) REFERENCES `optional_subject_retest_student` (`serial_std`, `serial_osr`),
  ADD CONSTRAINT `fk_relationship_216` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `opt_subject_year_activity_criteria_period`
--
ALTER TABLE `opt_subject_year_activity_criteria_period`
  ADD CONSTRAINT `fk_relationship_115` FOREIGN KEY (`serial_gct`, `serial_osb`) REFERENCES `opt_subject_year_grade_criteria` (`serial_gct`, `serial_osb`),
  ADD CONSTRAINT `fk_relationship_114` FOREIGN KEY (`serial_att`, `serial_prd`) REFERENCES `opt_subject_period_activity_type` (`serial_att`, `serial_prd`);

--
-- Filtros para la tabla `opt_subject_year_grade_criteria`
--
ALTER TABLE `opt_subject_year_grade_criteria`
  ADD CONSTRAINT `fk_relationship_111` FOREIGN KEY (`serial_gct`) REFERENCES `grade_criteria` (`serial_gct`),
  ADD CONSTRAINT `fk_relationship_110` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`);

--
-- Filtros para la tabla `payment_agreement_group`
--
ALTER TABLE `payment_agreement_group`
  ADD CONSTRAINT `fk_relationship_292` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `payment_detail`
--
ALTER TABLE `payment_detail`
  ADD CONSTRAINT `fk_relationship_192` FOREIGN KEY (`serial_fin`) REFERENCES `financial_institution` (`serial_fin`),
  ADD CONSTRAINT `fk_relationship_172` FOREIGN KEY (`serial_phy`) REFERENCES `invoice` (`serial_phy`),
  ADD CONSTRAINT `fk_relationship_342` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_173` FOREIGN KEY (`serial_pym`) REFERENCES `payment_method` (`serial_pym`),
  ADD CONSTRAINT `fk_relationship_191` FOREIGN KEY (`serial_ccd`) REFERENCES `credit_card` (`serial_ccd`);

--
-- Filtros para la tabla `period`
--
ALTER TABLE `period`
  ADD CONSTRAINT `fk_periods_by_group` FOREIGN KEY (`serial_pgy`) REFERENCES `period_group_year` (`serial_pgy`);

--
-- Filtros para la tabla `period_group_year`
--
ALTER TABLE `period_group_year`
  ADD CONSTRAINT `fk_period_for_year` FOREIGN KEY (`serial_cpd`) REFERENCES `cat_period` (`serial_cpd`),
  ADD CONSTRAINT `fk_periods_in_year` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `pre_registration`
--
ALTER TABLE `pre_registration`
  ADD CONSTRAINT `fk_user_register` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_registered_nationality` FOREIGN KEY (`serial_nnt`) REFERENCES `nationality` (`serial_nnt`),
  ADD CONSTRAINT `fk_relationship_241` FOREIGN KEY (`serial_ste`) REFERENCES `state` (`serial_ste`),
  ADD CONSTRAINT `fk_relationship_64` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_67` FOREIGN KEY (`serial_dgr`) REFERENCES `degree` (`serial_dgr`);

--
-- Filtros para la tabla `pre_registration_period`
--
ALTER TABLE `pre_registration_period`
  ADD CONSTRAINT `fk_relationship_73` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `pre_registration_required_documment`
--
ALTER TABLE `pre_registration_required_documment`
  ADD CONSTRAINT `fk_relationship_265` FOREIGN KEY (`serial_wpr`) REFERENCES `web_pre_registration` (`serial_wpr`),
  ADD CONSTRAINT `fk_relationship_263` FOREIGN KEY (`serial_ypd`) REFERENCES `year_pre_registration_document` (`serial_ypd`),
  ADD CONSTRAINT `fk_relationship_264` FOREIGN KEY (`serial_prt`) REFERENCES `pre_registration` (`serial_prt`);

--
-- Filtros para la tabla `process`
--
ALTER TABLE `process`
  ADD CONSTRAINT `fk_parent_process` FOREIGN KEY (`prc_serial_prc`) REFERENCES `process` (`serial_prc`);

--
-- Filtros para la tabla `profile_process`
--
ALTER TABLE `profile_process`
  ADD CONSTRAINT `fk_in_profile` FOREIGN KEY (`serial_prc`) REFERENCES `process` (`serial_prc`),
  ADD CONSTRAINT `fk_has_process` FOREIGN KEY (`serial_prf`) REFERENCES `profile` (`serial_prf`);

--
-- Filtros para la tabla `psychological_file`
--
ALTER TABLE `psychological_file`
  ADD CONSTRAINT `fk_relationship_89` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`);

--
-- Filtros para la tabla `qualitative_equivalence`
--
ALTER TABLE `qualitative_equivalence`
  ADD CONSTRAINT `fk_relationship_161` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `request_detail`
--
ALTER TABLE `request_detail`
  ADD CONSTRAINT `fk_relationship_189` FOREIGN KEY (`serial_srq`) REFERENCES `stock_request` (`serial_srq`),
  ADD CONSTRAINT `fk_relationship_188` FOREIGN KEY (`serial_ist`) REFERENCES `income_stock` (`serial_ist`);

--
-- Filtros para la tabla `resit_change_log`
--
ALTER TABLE `resit_change_log`
  ADD CONSTRAINT `fk_relationship_220` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`),
  ADD CONSTRAINT `fk_relationship_218` FOREIGN KEY (`remote_id_rst`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`, `type_rst`) REFERENCES `resit_student` (`remote_id_rst`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`, `type_rst`),
  ADD CONSTRAINT `fk_relationship_219` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `resit_student`
--
ALTER TABLE `resit_student`
  ADD CONSTRAINT `fk_relationship_211` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`),
  ADD CONSTRAINT `fk_relationship_209` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `schedule`
--
ALTER TABLE `schedule`
  ADD CONSTRAINT `fk_relationship_288` FOREIGN KEY (`serial_clr`) REFERENCES `classroom` (`serial_clr`),
  ADD CONSTRAINT `fk_relationship_283` FOREIGN KEY (`serial_cdt`) REFERENCES `credits_detail` (`serial_cdt`),
  ADD CONSTRAINT `fk_relationship_284` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`),
  ADD CONSTRAINT `fk_relationship_285` FOREIGN KEY (`serial_crs`) REFERENCES `course` (`serial_crs`),
  ADD CONSTRAINT `fk_relationship_286` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`),
  ADD CONSTRAINT `fk_relationship_287` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`);

--
-- Filtros para la tabla `school_setup`
--
ALTER TABLE `school_setup`
  ADD CONSTRAINT `fk_school_state` FOREIGN KEY (`serial_ste`) REFERENCES `state` (`serial_ste`),
  ADD CONSTRAINT `fk_currency_for_school` FOREIGN KEY (`serial_crr`) REFERENCES `currency` (`serial_crr`);

--
-- Filtros para la tabla `section_by_year`
--
ALTER TABLE `section_by_year`
  ADD CONSTRAINT `fk_year_sections` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`),
  ADD CONSTRAINT `fk_section_in_year` FOREIGN KEY (`serial_set`) REFERENCES `section` (`serial_set`);

--
-- Filtros para la tabla `special_grade_change_log`
--
ALTER TABLE `special_grade_change_log`
  ADD CONSTRAINT `fk_relationship_223` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_221` FOREIGN KEY (`serial_ysg`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year_special_grade` (`serial_ysg`, `serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_222` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`);

--
-- Filtros para la tabla `state`
--
ALTER TABLE `state`
  ADD CONSTRAINT `fk_country_state` FOREIGN KEY (`serial_cou`) REFERENCES `country` (`serial_cou`);

--
-- Filtros para la tabla `stock_request`
--
ALTER TABLE `stock_request`
  ADD CONSTRAINT `fk_relationship_190` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_187` FOREIGN KEY (`serial_udt`) REFERENCES `use_destination` (`serial_udt`);

--
-- Filtros para la tabla `student`
--
ALTER TABLE `student`
  ADD CONSTRAINT `fk_student_user` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_240` FOREIGN KEY (`serial_ste`) REFERENCES `state` (`serial_ste`),
  ADD CONSTRAINT `fk_relationship_61` FOREIGN KEY (`serial_nnt`) REFERENCES `nationality` (`serial_nnt`);

--
-- Filtros para la tabla `student_by_course`
--
ALTER TABLE `student_by_course`
  ADD CONSTRAINT `fk_student_in_course` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_course_for_student` FOREIGN KEY (`serial_crs`) REFERENCES `course` (`serial_crs`);

--
-- Filtros para la tabla `student_criteria_grade`
--
ALTER TABLE `student_criteria_grade`
  ADD CONSTRAINT `fk_relationship_99` FOREIGN KEY (`serial_att`, `serial_prd`, `serial_sbc`, `serial_gct`, `serial_act`) REFERENCES `activity_applied_criterias` (`serial_att`, `serial_prd`, `serial_sbc`, `serial_gct`, `serial_act`),
  ADD CONSTRAINT `fk_relationship_100` FOREIGN KEY (`serial_std`, `serial_crs`) REFERENCES `student_by_course` (`serial_std`, `serial_crs`);

--
-- Filtros para la tabla `student_guardian`
--
ALTER TABLE `student_guardian`
  ADD CONSTRAINT `fk_is_guardian` FOREIGN KEY (`serial_grd`) REFERENCES `guardian` (`serial_grd`),
  ADD CONSTRAINT `fk_has_guardian` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`);

--
-- Filtros para la tabla `student_optional_subject`
--
ALTER TABLE `student_optional_subject`
  ADD CONSTRAINT `fk_relationship_246` FOREIGN KEY (`serial_prd`, `serial_lop`) REFERENCES `level_optional_group_detail` (`serial_prd`, `serial_lop`),
  ADD CONSTRAINT `fk_relationship_108` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`),
  ADD CONSTRAINT `fk_relationship_109` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`);

--
-- Filtros para la tabla `student_subject_period_average`
--
ALTER TABLE `student_subject_period_average`
  ADD CONSTRAINT `fk_relationship_253` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`),
  ADD CONSTRAINT `fk_relationship_248` FOREIGN KEY (`stu_serial_ssa`) REFERENCES `student_subject_period_average` (`serial_ssa`),
  ADD CONSTRAINT `fk_relationship_250` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`),
  ADD CONSTRAINT `fk_relationship_251` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`),
  ADD CONSTRAINT `fk_relationship_252` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `student_year`
--
ALTER TABLE `student_year`
  ADD CONSTRAINT `fk_relationship_75` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_291` FOREIGN KEY (`serial_pag`) REFERENCES `payment_agreement_group` (`serial_pag`),
  ADD CONSTRAINT `fk_relationship_74` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`);

--
-- Filtros para la tabla `student_year_debts`
--
ALTER TABLE `student_year_debts`
  ADD CONSTRAINT `fk_relationship_103` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_102` FOREIGN KEY (`serial_ypc`) REFERENCES `year_level_specialty_payment_concept` (`serial_ypc`);

--
-- Filtros para la tabla `student_year_discount`
--
ALTER TABLE `student_year_discount`
  ADD CONSTRAINT `fk_relationship_229` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_228` FOREIGN KEY (`serial_ydc`) REFERENCES `year_discount` (`serial_ydc`);

--
-- Filtros para la tabla `student_year_discount_values`
--
ALTER TABLE `student_year_discount_values`
  ADD CONSTRAINT `fk_relationship_235` FOREIGN KEY (`serial_pct`) REFERENCES `payment_concept` (`serial_pct`),
  ADD CONSTRAINT `fk_relationship_230` FOREIGN KEY (`serial_std`, `serial_ydc`) REFERENCES `student_year_discount` (`serial_std`, `serial_ydc`);

--
-- Filtros para la tabla `student_year_document`
--
ALTER TABLE `student_year_document`
  ADD CONSTRAINT `fk_relationship_160` FOREIGN KEY (`serial_yqd`) REFERENCES `year_qualifying_document` (`serial_yqd`),
  ADD CONSTRAINT `fk_relationship_159` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `student_year_special_grade`
--
ALTER TABLE `student_year_special_grade`
  ADD CONSTRAINT `fk_relationship_180` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_179` FOREIGN KEY (`serial_ysg`) REFERENCES `year_special_grade` (`serial_ysg`);

--
-- Filtros para la tabla `subject`
--
ALTER TABLE `subject`
  ADD CONSTRAINT `fk_year_subject` FOREIGN KEY (`serial_csb`) REFERENCES `cat_subject` (`serial_csb`),
  ADD CONSTRAINT `fk_subject_fo__level` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `subject_course`
--
ALTER TABLE `subject_course`
  ADD CONSTRAINT `fk_subject_for_course` FOREIGN KEY (`serial_sbj`) REFERENCES `subject` (`serial_sbj`),
  ADD CONSTRAINT `fk_course_with_subject` FOREIGN KEY (`serial_crs`) REFERENCES `course` (`serial_crs`),
  ADD CONSTRAINT `fk_is_teacher` FOREIGN KEY (`serial_aca`, `serial_emp`) REFERENCES `employee_area` (`serial_aca`, `serial_emp`);

--
-- Filtros para la tabla `subject_course_period`
--
ALTER TABLE `subject_course_period`
  ADD CONSTRAINT `fk_relationship_72` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`),
  ADD CONSTRAINT `fk_relationship_71` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`);

--
-- Filtros para la tabla `subject_course_retest`
--
ALTER TABLE `subject_course_retest`
  ADD CONSTRAINT `fk_relationship_201` FOREIGN KEY (`serial_prd`, `serial_sbc`) REFERENCES `subject_course_period` (`serial_prd`, `serial_sbc`);

--
-- Filtros para la tabla `subject_course_retest_student`
--
ALTER TABLE `subject_course_retest_student`
  ADD CONSTRAINT `fk_relationship_203` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_202` FOREIGN KEY (`serial_scr`) REFERENCES `subject_course_retest` (`serial_scr`);

--
-- Filtros para la tabla `subject_level_restriction`
--
ALTER TABLE `subject_level_restriction`
  ADD CONSTRAINT `fk_relationship_268` FOREIGN KEY (`serial_hbg`) REFERENCES `hour_by_group` (`serial_hbg`),
  ADD CONSTRAINT `fk_relationship_266` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`),
  ADD CONSTRAINT `fk_relationship_267` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`);

--
-- Filtros para la tabla `subject_ministry_equivalence`
--
ALTER TABLE `subject_ministry_equivalence`
  ADD CONSTRAINT `fk_relationship_247` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`),
  ADD CONSTRAINT `fk_relationship_166` FOREIGN KEY (`serial_msb`) REFERENCES `ministry_subject` (`serial_msb`),
  ADD CONSTRAINT `fk_relationship_169` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`),
  ADD CONSTRAINT `fk_relationship_193` FOREIGN KEY (`serial_csb`) REFERENCES `cat_subject` (`serial_csb`),
  ADD CONSTRAINT `fk_relationship_204` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `subject_period_activity_type`
--
ALTER TABLE `subject_period_activity_type`
  ADD CONSTRAINT `fk_relationship_85` FOREIGN KEY (`serial_att`) REFERENCES `activity_type` (`serial_att`),
  ADD CONSTRAINT `fk_relationship_84` FOREIGN KEY (`serial_prd`, `serial_sbc`) REFERENCES `subject_course_period` (`serial_prd`, `serial_sbc`);

--
-- Filtros para la tabla `subject_retest_change_log`
--
ALTER TABLE `subject_retest_change_log`
  ADD CONSTRAINT `fk_relationship_214` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_212` FOREIGN KEY (`serial_std`, `serial_scr`) REFERENCES `subject_course_retest_student` (`serial_std`, `serial_scr`),
  ADD CONSTRAINT `fk_relationship_213` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`);

--
-- Filtros para la tabla `subject_year_activity_criteria_period`
--
ALTER TABLE `subject_year_activity_criteria_period`
  ADD CONSTRAINT `fk_relationship_87` FOREIGN KEY (`serial_sbj`, `serial_gct`) REFERENCES `subject_year_grade_criteria` (`serial_sbj`, `serial_gct`),
  ADD CONSTRAINT `fk_relationship_86` FOREIGN KEY (`serial_att`, `serial_prd`, `serial_sbc`) REFERENCES `subject_period_activity_type` (`serial_att`, `serial_prd`, `serial_sbc`);

--
-- Filtros para la tabla `subject_year_grade_criteria`
--
ALTER TABLE `subject_year_grade_criteria`
  ADD CONSTRAINT `fk_relationship_83` FOREIGN KEY (`serial_gct`) REFERENCES `grade_criteria` (`serial_gct`),
  ADD CONSTRAINT `fk_relationship_82` FOREIGN KEY (`serial_sbj`) REFERENCES `subject` (`serial_sbj`);

--
-- Filtros para la tabla `syllabus_files`
--
ALTER TABLE `syllabus_files`
  ADD CONSTRAINT `fk_relationship_129` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`),
  ADD CONSTRAINT `fk_relationship_128` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`);

--
-- Filtros para la tabla `syllabus_files_change_log`
--
ALTER TABLE `syllabus_files_change_log`
  ADD CONSTRAINT `fk_relationship_133` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_relationship_132` FOREIGN KEY (`serial_syf`) REFERENCES `syllabus_files` (`serial_syf`);

--
-- Filtros para la tabla `teacher_hours_year`
--
ALTER TABLE `teacher_hours_year`
  ADD CONSTRAINT `fk_relationship_70` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`),
  ADD CONSTRAINT `fk_relationship_69` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`);

--
-- Filtros para la tabla `user`
--
ALTER TABLE `user`
  ADD CONSTRAINT `fk_student_user2` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_employee_user2` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`),
  ADD CONSTRAINT `fk_guardian_user2` FOREIGN KEY (`serial_grd`) REFERENCES `guardian` (`serial_grd`);

--
-- Filtros para la tabla `user_profile`
--
ALTER TABLE `user_profile`
  ADD CONSTRAINT `fk_has_profile` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`),
  ADD CONSTRAINT `fk_for_user` FOREIGN KEY (`serial_prf`) REFERENCES `profile` (`serial_prf`);

--
-- Filtros para la tabla `visits_medical_center`
--
ALTER TABLE `visits_medical_center`
  ADD CONSTRAINT `fk_relationship_197` FOREIGN KEY (`serial_mdf`) REFERENCES `medical_file` (`serial_mdf`);

--
-- Filtros para la tabla `web_pre_registration`
--
ALTER TABLE `web_pre_registration`
  ADD CONSTRAINT `fk_relationship_242` FOREIGN KEY (`serial_ste`) REFERENCES `state` (`serial_ste`),
  ADD CONSTRAINT `fk_relationship_205` FOREIGN KEY (`serial_dgr`) REFERENCES `degree` (`serial_dgr`),
  ADD CONSTRAINT `fk_relationship_206` FOREIGN KEY (`serial_nnt`) REFERENCES `nationality` (`serial_nnt`),
  ADD CONSTRAINT `fk_relationship_207` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_208` FOREIGN KEY (`serial_wus`) REFERENCES `web_user` (`serial_wus`);

--
-- Filtros para la tabla `year_concept_taxes`
--
ALTER TABLE `year_concept_taxes`
  ADD CONSTRAINT `fk_relationship_94` FOREIGN KEY (`serial_ypc`) REFERENCES `year_level_specialty_payment_concept` (`serial_ypc`),
  ADD CONSTRAINT `fk_relationship_93` FOREIGN KEY (`serial_tax`) REFERENCES `taxes` (`serial_tax`);

--
-- Filtros para la tabla `year_discount`
--
ALTER TABLE `year_discount`
  ADD CONSTRAINT `fk_relationship_225` FOREIGN KEY (`serial_dsc`) REFERENCES `discount` (`serial_dsc`),
  ADD CONSTRAINT `fk_relationship_224` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `year_grade_subject`
--
ALTER TABLE `year_grade_subject`
  ADD CONSTRAINT `fk_relationship_175` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`),
  ADD CONSTRAINT `fk_relationship_174` FOREIGN KEY (`serial_csb`) REFERENCES `cat_subject` (`serial_csb`);

--
-- Filtros para la tabla `year_level_specialty_payment_concept`
--
ALTER TABLE `year_level_specialty_payment_concept`
  ADD CONSTRAINT `fk_relationship_92` FOREIGN KEY (`serial_art`) REFERENCES `article` (`serial_art`),
  ADD CONSTRAINT `fk_relationship_90` FOREIGN KEY (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year_specialty` (`serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`),
  ADD CONSTRAINT `fk_relationship_91` FOREIGN KEY (`serial_pct`) REFERENCES `payment_concept` (`serial_pct`);

--
-- Filtros para la tabla `year_pre_registration_document`
--
ALTER TABLE `year_pre_registration_document`
  ADD CONSTRAINT `fk_relationship_262` FOREIGN KEY (`serial_qdc`) REFERENCES `qualifying_document` (`serial_qdc`),
  ADD CONSTRAINT `fk_relationship_261` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `year_qualifying_document`
--
ALTER TABLE `year_qualifying_document`
  ADD CONSTRAINT `fk_relationship_158` FOREIGN KEY (`serial_qdc`) REFERENCES `qualifying_document` (`serial_qdc`),
  ADD CONSTRAINT `fk_relationship_157` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `year_report_comment`
--
ALTER TABLE `year_report_comment`
  ADD CONSTRAINT `fk_relationship_260` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`),
  ADD CONSTRAINT `fk_relationship_259` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`);

--
-- Filtros para la tabla `year_resit_exam_ranges`
--
ALTER TABLE `year_resit_exam_ranges`
  ADD CONSTRAINT `fk_relationship_162` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `year_special_grade`
--
ALTER TABLE `year_special_grade`
  ADD CONSTRAINT `fk_relationship_178` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`);

--
-- Filtros para la tabla `year_subject_classroom`
--
ALTER TABLE `year_subject_classroom`
  ADD CONSTRAINT `fk_relationship_165` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`),
  ADD CONSTRAINT `fk_relationship_163` FOREIGN KEY (`serial_clr`) REFERENCES `classroom` (`serial_clr`),
  ADD CONSTRAINT `fk_relationship_164` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`);


--
-- Filtros para la tabla `autoschedule_process`
--
ALTER TABLE `autoschedule_process`
  ADD CONSTRAINT `fk_relationship_294` FOREIGN KEY (`serial_scy`) REFERENCES `school_year` (`serial_scy`),
  ADD CONSTRAINT `fk_relationship_293` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);

--
-- Filtros para la tabla `autoschedule_process_results`
--
ALTER TABLE `autoschedule_process_results`
  ADD CONSTRAINT `fk_relationship_301` FOREIGN KEY (`serial_cdt`) REFERENCES `credits_detail` (`serial_cdt`),
  ADD CONSTRAINT `fk_relationship_295` FOREIGN KEY (`serial_asp`) REFERENCES `autoschedule_process` (`serial_asp`),
  ADD CONSTRAINT `fk_relationship_296` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`),
  ADD CONSTRAINT `fk_relationship_297` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`),
  ADD CONSTRAINT `fk_relationship_298` FOREIGN KEY (`serial_clr`) REFERENCES `classroom` (`serial_clr`),
  ADD CONSTRAINT `fk_relationship_299` FOREIGN KEY (`serial_crs`) REFERENCES `course` (`serial_crs`),
  ADD CONSTRAINT `fk_relationship_300` FOREIGN KEY (`serial_emp`) REFERENCES `employee` (`serial_emp`);



--
-- Filtros para la tabla `period_exam_grade_change_log`
--
ALTER TABLE `period_exam_grade_change_log`
  ADD CONSTRAINT `fk_relationship_312` FOREIGN KEY (`serial_chr`) REFERENCES `change_reason` (`serial_chr`),
  ADD CONSTRAINT `fk_relationship_310` FOREIGN KEY (`serial_spx`, `serial_std`) REFERENCES `student_period_exam` (`serial_spx`, `serial_std`),
  ADD CONSTRAINT `fk_relationship_311` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);
--
-- Filtros para la tabla `student_period_comment`
--
ALTER TABLE `student_period_comment`
  ADD CONSTRAINT `fk_relationship_318` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_315` FOREIGN KEY (`serial_usr`, `serial_crs`) REFERENCES `user_course_comment_setup` (`serial_usr`, `serial_crs`),
  ADD CONSTRAINT `fk_relationship_316` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`);

--
-- Filtros para la tabla `student_period_exam`
--
ALTER TABLE `student_period_exam`
  ADD CONSTRAINT `fk_relationship_309` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_308` FOREIGN KEY (`serial_spx`) REFERENCES `subject_period_exam` (`serial_spx`);

--
-- Filtros para la tabla `subject_period_exam`
--
ALTER TABLE `subject_period_exam`
  ADD CONSTRAINT `fk_relationship_307` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`),
  ADD CONSTRAINT `fk_relationship_305` FOREIGN KEY (`serial_ype`) REFERENCES `year_period_exam_setup` (`serial_ype`),
  ADD CONSTRAINT `fk_relationship_306` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`);

--
-- Filtros para la tabla `subperiod`
--
ALTER TABLE `subperiod`
  ADD CONSTRAINT `fk_relationship_302` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`);

--
-- Filtros para la tabla `user_course_comment_setup`
--
ALTER TABLE `user_course_comment_setup`
  ADD CONSTRAINT `fk_relationship_314` FOREIGN KEY (`serial_crs`) REFERENCES `course` (`serial_crs`),
  ADD CONSTRAINT `fk_relationship_313` FOREIGN KEY (`serial_usr`) REFERENCES `user` (`serial_usr`);
--
-- Filtros para la tabla `year_period_exam_setup`
--
ALTER TABLE `year_period_exam_setup`
  ADD CONSTRAINT `fk_relationship_304` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`),
  ADD CONSTRAINT `fk_relationship_303` FOREIGN KEY (`serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year` (`serial_lvl`, `serial_scy`, `serial_set`);

--
-- Filtros para la tabla `student_period_subject_skill_grade`
--
ALTER TABLE `student_period_subject_skill_grade`
  ADD CONSTRAINT `fk_relationship_327` FOREIGN KEY (`serial_std`) REFERENCES `student` (`serial_std`),
  ADD CONSTRAINT `fk_relationship_323` FOREIGN KEY (`serial_prd`) REFERENCES `period` (`serial_prd`),
  ADD CONSTRAINT `fk_relationship_324` FOREIGN KEY (`serial_yss`) REFERENCES `year_subject_skills` (`serial_yss`),
  ADD CONSTRAINT `fk_relationship_325` FOREIGN KEY (`serial_osc`) REFERENCES `level_opt_skill_criteria` (`serial_osc`),
  ADD CONSTRAINT `fk_relationship_326` FOREIGN KEY (`serial_lsc`) REFERENCES `level_skill_grade_criteria` (`serial_lsc`);



--
-- Filtros para la tabla `level_opt_skill_criteria`
--
ALTER TABLE `level_opt_skill_criteria`
  ADD CONSTRAINT `fk_relationship_319` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`);


--
-- Filtros para la tabla `level_skill_grade_criteria`
--
ALTER TABLE `level_skill_grade_criteria`
  ADD CONSTRAINT `fk_relationship_317` FOREIGN KEY (`serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `level_section_year` (`serial_lvl`, `serial_scy`, `serial_set`);


--
-- Filtros para la tabla `year_subject_skills`
--
ALTER TABLE `year_subject_skills`
  ADD CONSTRAINT `fk_relationship_322` FOREIGN KEY (`serial_osb`) REFERENCES `optional_subject` (`serial_osb`),
  ADD CONSTRAINT `fk_relationship_320` FOREIGN KEY (`serial_skl`) REFERENCES `skills` (`serial_skl`),
  ADD CONSTRAINT `fk_relationship_321` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`);

--
-- Filtros para la tabla `student_subject_subperiod_averages`
--
ALTER TABLE `student_subject_subperiod_average` 
ADD CONSTRAINT `fk_relationship_346` FOREIGN KEY (`serial_sbp`) REFERENCES `subperiod` (`serial_sbp`) ON DELETE restrict ON UPDATE restrict;
ADD CONSTRAINT `fk_relationship_347` FOREIGN KEY (`serial_sbc`) REFERENCES `subject_course` (`serial_sbc`) ON DELETE restrict ON UPDATE restrict;
ADD CONSTRAINT `fk_relationship_348` FOREIGN KEY (`serial_lop`) REFERENCES `level_optional_group` (`serial_lop`) ON DELETE restrict ON UPDATE restrict;
ADD CONSTRAINT `fk_relationship_349` FOREIGN KEY (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) REFERENCES `student_year` (`serial_std`, `serial_spt`, `serial_lvl`, `serial_scy`, `serial_set`) ON DELETE restrict ON UPDATE restrict;
