/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     11/08/2011 9:11:01                           */
/*==============================================================*/


drop table if exists academic_area;

drop table if exists access_log;

drop table if exists activity;

drop table if exists activity_applied_criterias;

drop table if exists activity_attachment;

drop table if exists activity_policy_violations;

drop table if exists activity_type;

drop table if exists allowed_pages_by_process;

drop table if exists article;

drop table if exists attendance;

drop table if exists author;

drop table if exists authority;

drop table if exists authority_charge;

drop table if exists autoschedule_process;

drop table if exists autoschedule_process_results;

drop table if exists book;

drop table if exists book_author;

drop table if exists book_category;

drop table if exists book_copy;

drop table if exists bus;

drop table if exists bus_driver;

drop table if exists bus_shift_year;

drop table if exists bus_year_user;

drop table if exists cat_period;

drop table if exists cat_subject;

drop table if exists change_reason;

drop table if exists classroom;

drop table if exists class_group;

drop table if exists country;

drop table if exists course;

drop table if exists course_director;

drop table if exists credits_detail;

drop table if exists credit_card;

drop table if exists currency;

drop table if exists current_deferred;

drop table if exists degree;

drop table if exists discipline;

drop table if exists discount;

drop table if exists discount_payment_concept;

drop table if exists employee;

drop table if exists employee_area;

drop table if exists equipment;

drop table if exists financial_institution;

drop table if exists financial_institution_card;

drop table if exists general_activity;

drop table if exists general_activity_attendees;

drop table if exists general_discipline_log;

drop table if exists grade_change_log;

drop table if exists grade_criteria;

drop table if exists grade_score_change_log;

drop table if exists grade_subject_score;

drop table if exists group_hour;

drop table if exists group_hour_level;

drop table if exists group_optional_subject;

drop table if exists guardian;

drop table if exists guest;

drop table if exists hour;

drop table if exists hour_by_group;

drop table if exists incident;

drop table if exists income_stock;

drop table if exists invoice;

drop table if exists invoice_detail;

drop table if exists invoice_detail_non_academic;

drop table if exists invoice_non_academic;

drop table if exists item_category;

drop table if exists language;

drop table if exists level;

drop table if exists level_optional_group;

drop table if exists level_optional_group_detail;

drop table if exists level_opt_skill_criteria;

drop table if exists level_section_year;

drop table if exists level_section_year_specialty;

drop table if exists level_skill_grade_criteria;

drop table if exists library_section;

drop table if exists loan;

drop table if exists loan_detail;

drop table if exists maintenance_item;

drop table if exists master_degree;

drop table if exists medical_file;

drop table if exists message;

drop table if exists message_between_profiles;

drop table if exists message_thread;

drop table if exists message_thread_messages;

drop table if exists ministry_resit_change_log;

drop table if exists ministry_resit_student;

drop table if exists ministry_subject;

drop table if exists nationality;

drop table if exists optional_subject;

drop table if exists optional_subject_level;

drop table if exists optional_subject_period;

drop table if exists optional_subject_retest;

drop table if exists optional_subject_retest_student;

drop table if exists opt_activity;

drop table if exists opt_activity_applied_criterias;

drop table if exists opt_activity_attachment;

drop table if exists opt_grade_change_log;

drop table if exists opt_student_activity_attachment;

drop table if exists opt_student_criteria_grade;

drop table if exists opt_subject_period_activity_type;

drop table if exists opt_subject_retest_change_log;

drop table if exists opt_subject_year_activity_criteria_period;

drop table if exists opt_subject_year_grade_criteria;

drop table if exists payment_agreement_group;

drop table if exists payment_concept;

drop table if exists payment_detail;

drop table if exists payment_detail_non_academic;

drop table if exists payment_method;

drop table if exists period;

drop table if exists period_exam_grade_change_log;

drop table if exists period_group_year;

drop table if exists pre_registration;

drop table if exists pre_registration_period;

drop table if exists pre_registration_required_documment;

drop table if exists process;

drop table if exists profile;

drop table if exists profile_process;

drop table if exists provider;

drop table if exists psychological_file;

drop table if exists qualifying_document;

drop table if exists qualitative_equivalence;

drop table if exists request_detail;

drop table if exists resit_change_log;

drop table if exists resit_student;

drop table if exists route;

drop table if exists schedule;

drop table if exists school_setup;

drop table if exists school_year;

drop table if exists section;

drop table if exists section_by_year;

drop table if exists shift;

drop table if exists skills;

drop table if exists specialty;

drop table if exists special_grade_change_log;

drop table if exists state;

drop table if exists stock_request;

drop table if exists student;

drop table if exists student_activity_attachment;

drop table if exists student_by_course;

drop table if exists student_criteria_grade;

drop table if exists student_guardian;

drop table if exists student_optional_subject;

drop table if exists student_period_comment;

drop table if exists student_period_exam;

drop table if exists student_period_subject_skill_grade;

drop table if exists student_subject_period_average;

drop table if exists student_year;

drop table if exists student_year_debts;

drop table if exists student_year_discount;

drop table if exists student_year_discount_values;

drop table if exists student_year_document;

drop table if exists student_year_special_grade;

drop table if exists study_place;

drop table if exists subject;

drop table if exists subject_course;

drop table if exists subject_course_period;

drop table if exists subject_course_retest;

drop table if exists subject_course_retest_student;

drop table if exists subject_level_restriction;

drop table if exists subject_ministry_equivalence;

drop table if exists subject_period_activity_type;

drop table if exists subject_period_exam;

drop table if exists subject_retest_change_log;

drop table if exists subject_year_activity_criteria_period;

drop table if exists subject_year_grade_criteria;

drop table if exists subperiod;

drop table if exists syllabus_files;

drop table if exists syllabus_files_change_log;

drop table if exists taxes;

drop table if exists teacher_degree;

drop table if exists teacher_hours_year;

drop table if exists teacher_master_degree;

drop table if exists teacher_specialty;

drop table if exists university;

drop table if exists user;

drop table if exists user_course_comment_setup;

drop table if exists user_profile;

drop table if exists use_destination;

drop table if exists visits_medical_center;

drop table if exists web_pre_registration;

drop table if exists web_user;

drop table if exists year_concept_taxes;

drop table if exists year_discount;

drop table if exists year_grade_subject;

drop table if exists year_level_specialty_payment_concept;

drop table if exists year_period_exam_setup;

drop table if exists year_pre_registration_document;

drop table if exists year_qualifying_document;

drop table if exists year_report_comment;

drop table if exists year_resit_exam_ranges;

drop table if exists year_special_grade;

drop table if exists year_subject_classroom;

drop table if exists year_subject_skills;

/*==============================================================*/
/* Table: academic_area                                         */
/*==============================================================*/
create table academic_area
(
   serial_aca           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: access_log                                            */
/*==============================================================*/
create table access_log
(
   serial_alg           int not null auto_increment,
   serial_usr           int,
   serial_prf           int,
   login_date_alg       timestamp not null,
   primary key (serial_alg)
)
type = innodb;

/*==============================================================*/
/* Table: activity                                              */
/*==============================================================*/
create table activity
(
   serial_act           int not null auto_increment,
   name_act             varchar(256) not null,
   description_act      text not null,
   send_date_act        timestamp not null,
   due_date_act         timestamp not null,
   status_act           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_act)
)
type = innodb;

/*==============================================================*/
/* Table: activity_applied_criterias                            */
/*==============================================================*/
create table activity_applied_criterias
(
   serial_att           int not null,
   serial_prd           int not null,
   serial_sbc           int not null,
   serial_sbj           int not null,
   serial_gct           int not null,
   serial_act           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: activity_attachment                                   */
/*==============================================================*/
create table activity_attachment
(
   serial_ath           int not null auto_increment,
   serial_act           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: activity_policy_violations                            */
/*==============================================================*/
create table activity_policy_violations
(
   serial_opa           int,
   serial_act           int,
   serial_emp           int,
   start_date_apv       date not null,
   end_date_apv         date not null
)
type = innodb;

/*==============================================================*/
/* Table: activity_type                                         */
/*==============================================================*/
create table activity_type
(
   serial_att           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: allowed_pages_by_process                              */
/*==============================================================*/
create table allowed_pages_by_process
(
   serial_prc           int,
   url_dsc              varchar(1024) not null
)
type = innodb;

/*==============================================================*/
/* Table: article                                               */
/*==============================================================*/
create table article
(
   serial_art           int not null auto_increment,
   code_art             varchar(10) not null,
   name_art             varchar(250) not null,
   stock_art            int not null,
   status_art           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_art)
)
type = innodb;

/*==============================================================*/
/* Table: attendance                                            */
/*==============================================================*/
create table attendance
(
   serial_ace           int not null auto_increment,
   serial_std           int,
   serial_scd           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: author                                                */
/*==============================================================*/
create table author
(
   serial_atr           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: authority                                             */
/*==============================================================*/
create table authority
(
   serial_aut           int not null auto_increment,
   serial_atc           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: authority_charge                                      */
/*==============================================================*/
create table authority_charge
(
   serial_atc           int not null auto_increment,
   name_atc             varchar(100) not null,
   description_atc      text,
   status_atc           enum('ACTIVE','INACTIVE') not null,
   primary key (serial_atc)
)
type = innodb;

/*==============================================================*/
/* Table: autoschedule_process                                  */
/*==============================================================*/
create table autoschedule_process
(
   serial_asp           int not null auto_increment,
   serial_usr           int,
   serial_scy           int,
   date_asp             timestamp not null,
   status_asp           enum('PENDING','PROGRESS','DONE') not null default 'PENDING',
   desired_opt_asp      int not null default 1,
   primary key (serial_asp)
)
type = innodb;

/*==============================================================*/
/* Table: autoschedule_process_results                          */
/*==============================================================*/
create table autoschedule_process_results
(
   serial_asr           int not null auto_increment,
   serial_emp           int,
   serial_sbc           int,
   serial_crs           int,
   serial_cdt           int,
   serial_asp           int,
   serial_clr           int,
   serial_lop           int,
   option_asr           int not null,
   day_asr              enum('MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY') not null,
   primary key (serial_asr)
)
type = innodb;

/*==============================================================*/
/* Table: book                                                  */
/*==============================================================*/
create table book
(
   serial_bok           int not null auto_increment,
   serial_bct           int,
   serial_lst           int,
   classification_number_bok varchar(15),
   title_bok            varchar(1024) not null,
   editorial_bok        varchar(256),
   pages_bok            int,
   publication_year_bok int,
   publication_place_bok varchar(256),
   volume_bok           int,
   primary key (serial_bok)
)
type = innodb;

/*==============================================================*/
/* Table: book_author                                           */
/*==============================================================*/
create table book_author
(
   serial_atr           int,
   serial_bok           int,
   status_bka           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: book_category                                         */
/*==============================================================*/
create table book_category
(
   serial_bct           int not null auto_increment,
   boo_serial_bct       int,
   name_bct             varchar(256) not null,
   status_bct           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_bct)
)
type = innodb;

/*==============================================================*/
/* Table: book_copy                                             */
/*==============================================================*/
create table book_copy
(
   serial_bkc           int not null auto_increment,
   serial_bok           int,
   copy_number_bkc      int not null,
   available_bkc        enum('YES','NO') not null default 'YES',
   partial_damage_value_bkc decimal,
   total_damage_value_bkc decimal,
   status_bkc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_bkc)
)
type = innodb;

/*==============================================================*/
/* Table: bus                                                   */
/*==============================================================*/
create table bus
(
   serial_bus           int 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 not null,
   status_bus           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_bus)
)
type = innodb;

/*==============================================================*/
/* Table: bus_driver                                            */
/*==============================================================*/
create table bus_driver
(
   serial_bdr           int 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),
   mobile2_bdr          varchar(30),
   phone1_bdr           varchar(30) not null,
   phone2_bdr           varchar(30),
   phone3_bdr           varchar(30),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: bus_shift_year                                        */
/*==============================================================*/
create table bus_shift_year
(
   serial_bdr           int not null,
   serial_rot           int not null,
   serial_scy           int not null,
   serial_bus           int not null,
   serial_sft           int not null,
   bus_serial_bdr       int,
   status_bpy           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_rot, serial_scy, serial_bus, serial_sft)
)
type = innodb;

/*==============================================================*/
/* Table: bus_year_user                                         */
/*==============================================================*/
create table bus_year_user
(
   serial_usr           int,
   serial_rot           int,
   serial_scy           int,
   serial_bus           int,
   serial_sft           int,
   status_byu           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: cat_period                                            */
/*==============================================================*/
create table cat_period
(
   serial_cpd           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: cat_subject                                           */
/*==============================================================*/
create table cat_subject
(
   serial_csb           int not null auto_increment,
   cat_serial_csb       int,
   serial_aca           int,
   serial_lng           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: change_reason                                         */
/*==============================================================*/
create table change_reason
(
   serial_chr           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: classroom                                             */
/*==============================================================*/
create table classroom
(
   serial_clr           int not null auto_increment,
   name_clr             varchar(80) not null,
   capacity_clr         int not null,
   description_clr      text not null,
   status_clr           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_clr)
)
type = innodb;

/*==============================================================*/
/* Table: class_group                                           */
/*==============================================================*/
create table class_group
(
   serial_clg           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: country                                               */
/*==============================================================*/
create table country
(
   serial_cou           int not null auto_increment,
   name_cou             varchar(100),
   status_cou           enum('ACTIVE','INACTIVE') default 'ACTIVE',
   primary key (serial_cou)
)
type = innodb;

/*==============================================================*/
/* Table: course                                                */
/*==============================================================*/
create table course
(
   serial_crs           int not null auto_increment,
   serial_clg           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   attendance_crs       enum('DAY','CLASS') not null default 'DAY',
   status_crs           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_crs)
)
type = innodb;

/*==============================================================*/
/* Table: course_director                                       */
/*==============================================================*/
create table course_director
(
   serial_emp           int,
   serial_crs           int,
   status_crd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: credits_detail                                        */
/*==============================================================*/
create table credits_detail
(
   serial_cdt           int not null auto_increment,
   serial_hrs           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: credit_card                                           */
/*==============================================================*/
create table credit_card
(
   serial_ccd           int not null auto_increment,
   name_ccd             varchar(200) not null,
   status_ccd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ccd)
)
type = innodb;

/*==============================================================*/
/* Table: currency                                              */
/*==============================================================*/
create table currency
(
   serial_crr           int not null auto_increment,
   abrevation_crr       varchar(4),
   name_crr             varchar(300) not null,
   status_crr           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_crr)
)
type = innodb;

/*==============================================================*/
/* Table: current_deferred                                      */
/*==============================================================*/
create table current_deferred
(
   serial_cdf           int not null auto_increment,
   serial_usr           int,
   serial_fic           int,
   code_cdf             varchar(50),
   total_quotas_cdf     int not null,
   quota_amount_cdf     decimal(10,2) not null,
   paid_quotas_cdf      int,
   owner_cdf            varchar(300) not null,
   kinship_cdf          varchar(300) not null,
   last_month_paid_quota_cdf varchar(3),
   transaction_date_cdf timestamp 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)
)
type = innodb;

/*==============================================================*/
/* Table: degree                                                */
/*==============================================================*/
create table degree
(
   serial_dgr           int not null auto_increment,
   name_dgr             varchar(255) not null,
   status_dgr           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_dgr)
)
type = innodb;

/*==============================================================*/
/* Table: discipline                                            */
/*==============================================================*/
create table discipline
(
   serial_prd           int not null,
   serial_std           int not null,
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: discount                                              */
/*==============================================================*/
create table discount
(
   serial_dsc           int not null auto_increment,
   name_dsc             varchar(200) not null,
   status_dsc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_dsc)
)
type = innodb;

/*==============================================================*/
/* Table: discount_payment_concept                              */
/*==============================================================*/
create table discount_payment_concept
(
   serial_ydc           int not null,
   serial_pct           int not null,
   status_dpc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ydc, serial_pct)
)
type = innodb;

/*==============================================================*/
/* Table: employee                                              */
/*==============================================================*/
create table employee
(
   serial_emp           int not null auto_increment,
   serial_tdg           int,
   serial_usr           int not null,
   serial_grd           int,
   serial_mdg           int,
   serial_ste           int,
   serial_cou           int,
   serial_nnt           int,
   serial_tst           int,
   serial_unv           int,
   serial_tmd           int,
   serial_dgr           int,
   id_emp               varchar(13) not null,
   type_emp             set('TEACHING','ADMINISTRATIVE','SERVICES'),
   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),
   gender_emp           enum('MALE','FEMALE') not null,
   marital_status_emp   enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS'),
   birthdate_emp        date not null,
   address_emp          text not null,
   city_emp             varchar(150) not null,
   parish_emp           varchar(100),
   sector_emp           varchar(50),
   phone_emp            varchar(30) not null,
   phone2_emp           varchar(30),
   phone3_emp           varchar(30),
   cellphone_emp        varchar(30),
   email_emp            varchar(150),
   email2_emp           varchar(150),
   family_dependents_emp int,
   student_dependents_emp int,
   teaching_since_tea_emp date,
   seniority_university_tea_emp int,
   date_start_in_school_emp date not null,
   primary key (serial_emp)
)
type = innodb;

/*==============================================================*/
/* Table: employee_area                                         */
/*==============================================================*/
create table employee_area
(
   serial_aca           int not null,
   serial_emp           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: equipment                                             */
/*==============================================================*/
create table equipment
(
   serial_eqt           int not null auto_increment,
   code_eqt             varchar(20),
   name_eqt             varchar(512),
   partial_damage_value_eqt decimal,
   total_damage_value_eqt decimal,
   status_eqt           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   available_eqt        enum('YES','NO') not null default 'YES',
   primary key (serial_eqt)
)
type = innodb;

/*==============================================================*/
/* Table: financial_institution                                 */
/*==============================================================*/
create table financial_institution
(
   serial_fin           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: financial_institution_card                            */
/*==============================================================*/
create table financial_institution_card
(
   serial_fic           int not null auto_increment,
   serial_fin           int not null,
   serial_ccd           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: general_activity                                      */
/*==============================================================*/
create table general_activity
(
   serial_gac           int not null auto_increment,
   title_gac            varchar(50) not null,
   description_gac      text not null,
   create_date_gac      timestamp not null,
   from_date_gac        timestamp not null,
   to_date_gac          timestamp not null,
   type_gac             enum('GENERAL','PERSONAL') not null default 'GENERAL',
   attachment_gac       varchar(128),
   filename_gac         varchar(128),
   status_gac           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_gac)
)
type = innodb;

/*==============================================================*/
/* Table: general_activity_attendees                            */
/*==============================================================*/
create table general_activity_attendees
(
   serial_gaa           int not null auto_increment,
   serial_scy           int,
   serial_gac           int,
   type_gaa             enum('ALL','SECTION','COURSE','PERSONAL','TEACHER','EMPLOYEE','ACADEMIC_AREA') not null,
   remote_id_gaa        int,
   comments_gaa         text,
   status_gaa           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_gaa)
)
type = innodb;

/*==============================================================*/
/* Table: general_discipline_log                                */
/*==============================================================*/
create table general_discipline_log
(
   serial_usr           int,
   serial_chr           int,
   serial_prd           int,
   serial_std           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   change_date_gdl      timestamp not null,
   last_grade_gdl       decimal(8,5) not null,
   comment_gdl          text
)
type = innodb;

/*==============================================================*/
/* Table: grade_change_log                                      */
/*==============================================================*/
create table grade_change_log
(
   serial_usr           int,
   serial_chr           int,
   serial_sbc           int,
   serial_att           int,
   serial_prd           int,
   serial_gct           int,
   serial_act           int,
   serial_std           int,
   serial_crs           int,
   change_date_gcl      timestamp not null,
   last_grade_gcl       decimal(8,5),
   comment_gcl          text
)
type = innodb;

/*==============================================================*/
/* Table: grade_criteria                                        */
/*==============================================================*/
create table grade_criteria
(
   serial_gct           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: grade_score_change_log                                */
/*==============================================================*/
create table grade_score_change_log
(
   serial_chr           int,
   serial_usr           int,
   serial_ygs           int,
   serial_std           int,
   change_date_gsl      timestamp not null,
   last_grade_gsl       decimal(8,5) not null,
   comment_gsl          text
)
type = innodb;

/*==============================================================*/
/* Table: grade_subject_score                                   */
/*==============================================================*/
create table grade_subject_score
(
   serial_ygs           int not null,
   serial_std           int not null,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   score_gss            decimal(8,5),
   status_gss           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ygs, serial_std)
)
type = innodb;

/*==============================================================*/
/* Table: group_hour                                            */
/*==============================================================*/
create table group_hour
(
   serial_gph           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: group_hour_level                                      */
/*==============================================================*/
create table group_hour_level
(
   serial_gph           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   working_days_ghl     set('MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY'),
   status_ghl           enum('ACTIVE','INACTIVE') default 'ACTIVE',
   primary key (serial_gph, serial_lvl, serial_scy, serial_set)
)
type = innodb;

/*==============================================================*/
/* Table: group_optional_subject                                */
/*==============================================================*/
create table group_optional_subject
(
   serial_osb           int,
   serial_lop           int,
   status_gos           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: guardian                                              */
/*==============================================================*/
create table guardian
(
   serial_grd           int not null auto_increment,
   serial_usr           int not null,
   serial_emp           int,
   id_grd               varchar(13) not null,
   first_name_grd       varchar(512) not null,
   last_name_grd        varchar(512) not null,
   birthdate_grd        date,
   gender_grd           enum('MALE','FEMALE') not null,
   marital_status_grd   enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS') not null,
   alumnus_grd          enum('YES','NO') not null,
   address_grd          text not null,
   phone_grd            varchar(30) not null,
   mobile_grd           varchar(30),
   occupation_grd       varchar(50),
   company_name_grd     varchar(100),
   company_activity_grd varchar(80),
   company_phone_grd    varchar(13),
   email_grd            varchar(256),
   email2_grd           varchar(150),
   status_grd           enum('ACTIVE','INACTIVE','BLOCKED') not null default 'ACTIVE',
   primary key (serial_grd)
)
type = innodb;

/*==============================================================*/
/* Table: guest                                                 */
/*==============================================================*/
create table guest
(
   serial_gst           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: hour                                                  */
/*==============================================================*/
create table hour
(
   serial_hrs           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: hour_by_group                                         */
/*==============================================================*/
create table hour_by_group
(
   serial_hbg           int not null auto_increment,
   serial_hrs           int,
   serial_gph           int,
   status_hbg           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   credits_hbg          int,
   type_hbg             enum('NORMAL','LUNCH') not null default 'NORMAL',
   primary key (serial_hbg)
)
type = innodb;

/*==============================================================*/
/* Table: incident                                              */
/*==============================================================*/
create table incident
(
   serial_inc           int not null auto_increment,
   serial_usr           int,
   use_serial_usr       int,
   date_inc             date not null,
   report_date_inc      date not null,
   description_inc      text not null,
   primary key (serial_inc)
)
type = innodb;

/*==============================================================*/
/* Table: income_stock                                          */
/*==============================================================*/
create table income_stock
(
   serial_ist           int not null auto_increment,
   serial_prv           int,
   serial_usr           int,
   serial_mti           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: invoice                                               */
/*==============================================================*/
create table invoice
(
   serial_phy           int not null auto_increment,
   payment_date_phy     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),
   name_paying_phy      varchar(512),
   phone_paying_phy     varchar(30),
   address_paying_phy   varchar(1024),
   physical_number_phy  varchar(128),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: invoice_detail                                        */
/*==============================================================*/
create table invoice_detail
(
   serial_cdf           int,
   serial_sva           int,
   serial_deb           int,
   serial_phy           int,
   status_psd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: invoice_detail_non_academic                           */
/*==============================================================*/
create table invoice_detail_non_academic
(
   serial_sva           int,
   serial_cdf           int,
   serial_ina           int,
   serial_deb           int,
   status_idn           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: invoice_non_academic                                  */
/*==============================================================*/
create table invoice_non_academic
(
   serial_ina           int not null auto_increment,
   payment_date_ina     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),
   name_paying_ina      varchar(512),
   phone_paying_ina     varchar(30),
   address_paying_ina   varchar(1024),
   physical_number_ina  varchar(128),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: item_category                                         */
/*==============================================================*/
create table item_category
(
   serial_ict           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: language                                              */
/*==============================================================*/
create table language
(
   serial_lng           int not null auto_increment,
   abbreviation_lng     varchar(3),
   name_lng             varchar(50) not null,
   primary key (serial_lng)
)
type = innodb;

/*==============================================================*/
/* Table: level                                                 */
/*==============================================================*/
create table level
(
   serial_lvl           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: level_optional_group                                  */
/*==============================================================*/
create table level_optional_group
(
   serial_lop           int not null auto_increment,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   name_lop             varchar(256) not null,
   status_lop           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   hours_week_lop       int not null,
   hours_distribution_lop varchar(512),
   primary key (serial_lop)
)
type = innodb;

/*==============================================================*/
/* Table: level_optional_group_detail                           */
/*==============================================================*/
create table level_optional_group_detail
(
   serial_prd           int not null,
   serial_lop           int not null,
   weight_ogd           decimal(5,2) not null,
   status_ogd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_prd, serial_lop)
)
type = innodb;

/*==============================================================*/
/* Table: level_opt_skill_criteria                              */
/*==============================================================*/
create table level_opt_skill_criteria
(
   serial_osc           int not null auto_increment,
   serial_lop           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: level_section_year                                    */
/*==============================================================*/
create table level_section_year
(
   serial_pgy           int,
   serial_lvl           int not null,
   discipline_lsy       enum('SUPERVISOR','TEACHERS','BOTH'),
   supervisor_grade_weight_lsy decimal(5,2),
   teacher_grade_weight_lsy decimal(5,2),
   order_lsy            int,
   serial_scy           int not null,
   serial_set           int not null,
   status_lsy           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_lvl, serial_scy, serial_set)
)
type = innodb;

/*==============================================================*/
/* Table: level_section_year_specialty                          */
/*==============================================================*/
create table level_section_year_specialty
(
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   status_lss           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_spt, serial_lvl, serial_scy, serial_set)
)
type = innodb;

/*==============================================================*/
/* Table: level_skill_grade_criteria                            */
/*==============================================================*/
create table level_skill_grade_criteria
(
   serial_lsc           int not null auto_increment,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: library_section                                       */
/*==============================================================*/
create table library_section
(
   serial_lst           int not null auto_increment,
   name_lst             varchar(128) not null,
   status_lst           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_lst)
)
type = innodb;

/*==============================================================*/
/* Table: loan                                                  */
/*==============================================================*/
create table loan
(
   serial_loa           int not null auto_increment,
   serial_usr           int,
   date_loa             timestamp not null,
   due_date_loa         timestamp not null,
   status_loa           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_loa)
)
type = innodb;

/*==============================================================*/
/* Table: loan_detail                                           */
/*==============================================================*/
create table loan_detail
(
   serial_stp           int,
   serial_bkc           int,
   serial_loa           int,
   serial_eqt           int,
   returned_ldt         enum('YES','NO') not null default 'NO'
)
type = innodb;

/*==============================================================*/
/* Table: maintenance_item                                      */
/*==============================================================*/
create table maintenance_item
(
   serial_mti           int not null auto_increment,
   serial_ict           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: master_degree                                         */
/*==============================================================*/
create table master_degree
(
   serial_mdg           int not null auto_increment,
   name_mdg             varchar(255) not null,
   status_mdg           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_mdg)
)
type = innodb;

/*==============================================================*/
/* Table: medical_file                                          */
/*==============================================================*/
create table medical_file
(
   serial_mdf           int not null auto_increment,
   serial_usr           int,
   serial_gst           int,
   chronic_disease_mdf  text,
   allergy_mdf          text,
   allergy_medication_mdf text,
   reaction_medicine_mdf text,
   fever_medication_mdf text,
   headache_medication_mdf text,
   stomachache_medication_mdf text,
   registration_date_mdf date not null,
   status_mdf           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   family_physician_mdf varchar(256),
   emergency_call_name_mdf varchar(256),
   emergency_call_name2_mdf varchar(256),
   emergency_call_phone_mdf varchar(13),
   emergency_call_phone2_mdf varchar(13),
   hospital_preference1_mdf varchar(200),
   hospital_preference2_mdf varchar(200),
   blood_type_mdf       varchar(10),
   restrictions_mdf     text,
   emergency_auth_mdf   enum('YES','NO') not null default 'NO',
   physician_mobile_mdf varchar(30),
   physician_office_mdf varchar(255),
   primary key (serial_mdf)
)
type = innodb;

/*==============================================================*/
/* Table: message                                               */
/*==============================================================*/
create table message
(
   serial_msg           int not null auto_increment,
   serial_usr_receive   int,
   serial_prf           int,
   serial_usr_send      int,
   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,
   check_date_msg       timestamp,
   filename_msg         varchar(50),
   attachment_msg       varchar(50),
   priority_msg         enum('URGENT','NORMAL') not null default 'NORMAL',
   primary key (serial_msg)
)
type = innodb;

/*==============================================================*/
/* Table: message_between_profiles                              */
/*==============================================================*/
create table message_between_profiles
(
   serial_prf           int not null,
   pro_serial_prf       int not null,
   status_mbp           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_prf, pro_serial_prf)
)
type = innodb;

/*==============================================================*/
/* Table: message_thread                                        */
/*==============================================================*/
create table message_thread
(
   serial_mth           int not null auto_increment,
   serial_usr           int,
   start_date_mth       timestamp not null,
   primary key (serial_mth)
)
type = innodb;

/*==============================================================*/
/* Table: message_thread_messages                               */
/*==============================================================*/
create table message_thread_messages
(
   serial_mtm           int not null auto_increment,
   serial_mth           int,
   serial_msg           int,
   primary key (serial_mtm)
)
type = innodb;

/*==============================================================*/
/* Table: ministry_resit_change_log                             */
/*==============================================================*/
create table ministry_resit_change_log
(
   serial_usr           int,
   serial_chr           int,
   serial_msb           int,
   serial_std           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   change_date_mrc      timestamp not null,
   last_grade_mrc       decimal(8,5) not null,
   comment_mrc          text
)
type = innodb;

/*==============================================================*/
/* Table: ministry_resit_student                                */
/*==============================================================*/
create table ministry_resit_student
(
   serial_msb           int not null,
   serial_std           int not null,
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   required_grade_mrs   decimal(5,2) not null,
   grade_mrs            decimal(8,5),
   status_mrs           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_msb, serial_std, serial_spt, serial_lvl, serial_scy, serial_set)
)
type = innodb;

/*==============================================================*/
/* Table: ministry_subject                                      */
/*==============================================================*/
create table ministry_subject
(
   serial_msb           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: nationality                                           */
/*==============================================================*/
create table nationality
(
   serial_nnt           int not null auto_increment,
   name_nnt             varchar(255) not null,
   status_nnt           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_nnt)
)
type = innodb;

/*==============================================================*/
/* Table: optional_subject                                      */
/*==============================================================*/
create table optional_subject
(
   serial_osb           int not null auto_increment,
   serial_pgy           int,
   serial_csb           int,
   per_serial_pgy       int,
   serial_aca           int,
   serial_emp           int,
   status_osb           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   grade_type_sbc       enum('QUALITATIVE','QUANTITATIVE') not null default 'QUANTITATIVE',
   primary key (serial_osb)
)
type = innodb;

/*==============================================================*/
/* Table: optional_subject_level                                */
/*==============================================================*/
create table optional_subject_level
(
   serial_osb           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   status_osl           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: optional_subject_period                               */
/*==============================================================*/
create table optional_subject_period
(
   serial_prd           int not null,
   serial_osb           int not null,
   status_osp           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_prd, serial_osb)
)
type = innodb;

/*==============================================================*/
/* Table: optional_subject_retest                               */
/*==============================================================*/
create table optional_subject_retest
(
   serial_osr           int not null auto_increment,
   serial_prd           int,
   serial_osb           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: optional_subject_retest_student                       */
/*==============================================================*/
create table optional_subject_retest_student
(
   serial_std           int not null,
   serial_osr           int not null,
   grade_org            decimal(8,5),
   status_org           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_std, serial_osr)
)
type = innodb;

/*==============================================================*/
/* Table: opt_activity                                          */
/*==============================================================*/
create table opt_activity
(
   serial_opa           int not null auto_increment,
   name_opa             varchar(256) not null,
   description_opa      text not null,
   send_date_opa        timestamp not null,
   due_date_opa         timestamp not null,
   status_opa           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_opa)
)
type = innodb;

/*==============================================================*/
/* Table: opt_activity_applied_criterias                        */
/*==============================================================*/
create table opt_activity_applied_criterias
(
   serial_opa           int not null,
   serial_gct           int not null,
   serial_osb           int not null,
   serial_att           int not null,
   serial_prd           int not null,
   weight_oaa           decimal(5,2),
   status_oaa           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_opa, serial_gct, serial_osb, serial_att, serial_prd)
)
type = innodb;

/*==============================================================*/
/* Table: opt_activity_attachment                               */
/*==============================================================*/
create table opt_activity_attachment
(
   serial_oat           int not null auto_increment,
   serial_opa           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: opt_grade_change_log                                  */
/*==============================================================*/
create table opt_grade_change_log
(
   serial_usr           int,
   serial_chr           int,
   serial_opa           int,
   serial_gct           int,
   serial_osb           int,
   serial_att           int,
   serial_prd           int,
   serial_std           int,
   opt_change_date_ogc  timestamp not null,
   opt_last_grade_ogc   decimal(8,5),
   opt_comment_ogc      text
)
type = innodb;

/*==============================================================*/
/* Table: opt_student_activity_attachment                       */
/*==============================================================*/
create table opt_student_activity_attachment
(
   serial_oth           int not null auto_increment,
   serial_opa           int,
   serial_std           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: opt_student_criteria_grade                            */
/*==============================================================*/
create table opt_student_criteria_grade
(
   serial_opa           int not null,
   serial_gct           int not null,
   serial_osb           int not null,
   serial_att           int not null,
   serial_prd           int not null,
   serial_std           int 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),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: opt_subject_period_activity_type                      */
/*==============================================================*/
create table opt_subject_period_activity_type
(
   serial_att           int not null,
   serial_prd           int not null,
   serial_osb           int not null,
   weight_osa           decimal(5,2) not null,
   due_min_days_osa     int not null,
   due_max_grade_osa    int,
   status_osa           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_att, serial_prd, serial_osb)
)
type = innodb;

/*==============================================================*/
/* Table: opt_subject_retest_change_log                         */
/*==============================================================*/
create table opt_subject_retest_change_log
(
   serial_usr           int,
   serial_chr           int,
   serial_std           int,
   serial_osr           int,
   change_date_orl      timestamp not null,
   last_grade_orl       decimal(8,5) not null,
   comment_orl          text
)
type = innodb;

/*==============================================================*/
/* Table: opt_subject_year_activity_criteria_period             */
/*==============================================================*/
create table opt_subject_year_activity_criteria_period
(
   serial_gct           int not null,
   serial_osb           int not null,
   serial_att           int not null,
   serial_prd           int not null,
   status_oac           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_gct, serial_osb, serial_att, serial_prd)
)
type = innodb;

/*==============================================================*/
/* Table: opt_subject_year_grade_criteria                       */
/*==============================================================*/
create table opt_subject_year_grade_criteria
(
   serial_gct           int not null,
   serial_osb           int not null,
   status_oyc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_gct, serial_osb)
)
type = innodb;

/*==============================================================*/
/* Table: payment_agreement_group                               */
/*==============================================================*/
create table payment_agreement_group
(
   serial_pag           int not null auto_increment,
   serial_scy           int,
   code_pag             varchar(10) not null,
   description_pag      text,
   status_pag           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_pag)
)
type = innodb;

/*==============================================================*/
/* Table: payment_concept                                       */
/*==============================================================*/
create table payment_concept
(
   serial_pct           int not null auto_increment,
   name_pct             varchar(200) not null,
   status_pct           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_pct)
)
type = innodb;

/*==============================================================*/
/* Table: payment_detail                                        */
/*==============================================================*/
create table payment_detail
(
   serial_pym           int,
   serial_ccd           int,
   serial_fin           int,
   serial_phy           int,
   description_pdt      varchar(128) not null,
   document_number_pdt  varchar(128),
   amount_pdt           decimal(10,2) not null,
   kinship_pdt          varchar(80),
   owner_pdt            varchar(300),
   date_pdt             date,
   status_pdt           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: payment_detail_non_academic                           */
/*==============================================================*/
create table payment_detail_non_academic
(
   serial_ina           int,
   serial_fin           int,
   serial_ccd           int,
   serial_pym           int,
   description_pdn      varchar(128) not null,
   document_number_pdn  varchar(128),
   amount_pdn           decimal(10,2) not null,
   kinship_pdn          varchar(80),
   owner_pdn            varchar(300),
   date_pdn             date,
   status_pdn           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: payment_method                                        */
/*==============================================================*/
create table payment_method
(
   serial_pym           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: period                                                */
/*==============================================================*/
create table period
(
   serial_prd           int not null auto_increment,
   serial_pgy           int,
   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(5,2) not null,
   max_grade_prd        decimal(5,2) not null,
   warning_grade_prd    decimal(5,2) not null,
   weight_prd           decimal(5,2) not null,
   primary key (serial_prd)
)
type = innodb;

/*==============================================================*/
/* Table: period_exam_grade_change_log                          */
/*==============================================================*/
create table period_exam_grade_change_log
(
   serial_usr           int,
   serial_chr           int,
   serial_spx           int,
   serial_std           int,
   change_date_sxc      date not null,
   last_grade_sxc       decimal(8,5),
   comment_sxc          text
)
type = innodb;

/*==============================================================*/
/* Table: period_group_year                                     */
/*==============================================================*/
create table period_group_year
(
   serial_pgy           int not null auto_increment,
   serial_scy           int,
   serial_cpd           int,
   name_pgy             varchar(255),
   status_pgy           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_pgy)
)
type = innodb;

/*==============================================================*/
/* Table: pre_registration                                      */
/*==============================================================*/
create table pre_registration
(
   serial_prt           int not null auto_increment,
   serial_ste           int,
   serial_nnt           int,
   serial_usr           int,
   serial_dgr           int,
   id_prt               varchar(10),
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   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),
   last_name_father_prt varchar(100),
   first_name_mother_prt varchar(100),
   last_name_mother_prt varchar(100),
   city_birth_prt       varchar(100),
   blood_type_prt       varchar(10),
   allergies_prt        text,
   lives_with_prt       enum('PARENTS','FATHER','MOTHER','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER'),
   photo_prt            varchar(1024),
   email_prt            varchar(256),
   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,
   rep_city_birth_prt   varchar(100),
   rep_marital_status_prt enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS') not null,
   rep_occupation_prt   varchar(100),
   rep_address_prt      text not null,
   rep_phone_prt        varchar(13) not null,
   rep_mobile_prt       varchar(13),
   rep_company_name_prt varchar(80),
   rep_company_activity_prt text,
   rep_company_phone_prt varchar(13),
   rep_photo_prt        varchar(1024) not null,
   rep_alumnus_prt      enum('YES','NO') not null default 'NO',
   rep_gender_prt       enum('MALE','FEMALE') not null,
   rep_id_prt           varchar(13) not null,
   rep_email_prt        varchar(256),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: pre_registration_period                               */
/*==============================================================*/
create table pre_registration_period
(
   serial_scy           int,
   start_date_prp       date not null,
   end_date_prp         date not null,
   status_prp           enum('ACTIVE','INACTIVE','CLOSED','OPEN') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: pre_registration_required_documment                   */
/*==============================================================*/
create table pre_registration_required_documment
(
   serial_prt           int,
   serial_ypd           int,
   serial_wpr           int,
   filename_pdc         varchar(500),
   status_pdc           enum('PENDING','SUBMITTED') not null default 'PENDING'
)
type = innodb;

/*==============================================================*/
/* Table: process                                               */
/*==============================================================*/
create table process
(
   serial_prc           int not null auto_increment,
   prc_serial_prc       int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: profile                                               */
/*==============================================================*/
create table profile
(
   serial_prf           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: profile_process                                       */
/*==============================================================*/
create table profile_process
(
   serial_prf           int,
   serial_prc           int,
   status_ppr           enum('ACTIVE','BLOCKED') default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: provider                                              */
/*==============================================================*/
create table provider
(
   serial_prv           int 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),
   contact_name_prv     varchar(255) not null,
   status_prv           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_prv)
)
type = innodb;

/*==============================================================*/
/* Table: psychological_file                                    */
/*==============================================================*/
create table psychological_file
(
   serial_pyf           int not null auto_increment,
   serial_std           int,
   therapy_pyf          enum('PSYCHOLOGICAL','VERBAL','VISUAL','LEARNING','BEHAVIOUR','AUDITORY','FAMILY','OTHER'),
   discharged_pyf       enum('YES','NO'),
   diagnosis_pyf        text,
   diagnosed_by_pyf     text,
   therapy_time_pyf     text,
   abandon_reason_pyf   text,
   medication_pyf       text,
   therapeutic_center_pyf varchar(512),
   registration_date_pyf date not null,
   status_pyf           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_pyf)
)
type = innodb;

/*==============================================================*/
/* Table: qualifying_document                                   */
/*==============================================================*/
create table qualifying_document
(
   serial_qdc           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: qualitative_equivalence                               */
/*==============================================================*/
create table qualitative_equivalence
(
   serial_qeq           int not null auto_increment,
   serial_scy           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: request_detail                                        */
/*==============================================================*/
create table request_detail
(
   serial_ist           int,
   serial_srq           int,
   item_quantity_rdt    decimal(5,2) not null,
   status_rdt           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: resit_change_log                                      */
/*==============================================================*/
create table resit_change_log
(
   serial_usr           int,
   serial_chr           int,
   remote_id_rst        int,
   serial_std           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   type_rst             enum('CSB','LOP') default 'CSB',
   change_date_rcl      timestamp not null,
   last_grade_rcl       decimal(8,5) not null,
   comment_rcl          text
)
type = innodb;

/*==============================================================*/
/* Table: resit_student                                         */
/*==============================================================*/
create table resit_student
(
   serial_emp           int not null,
   remote_id_rst        int not null,
   serial_std           int not null,
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   required_grade_rst   decimal(8,5) not null,
   grade_rst            decimal(8,5),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: route                                                 */
/*==============================================================*/
create table route
(
   serial_rot           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: schedule                                              */
/*==============================================================*/
create table schedule
(
   serial_scd           int not null auto_increment,
   serial_lop           int,
   serial_sbc           int,
   serial_clr           int,
   serial_crs           int,
   serial_emp           int,
   serial_cdt           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: school_setup                                          */
/*==============================================================*/
create table school_setup
(
   serial_ste           int,
   serial_crr           int,
   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),
   phone3_sst           varchar(30),
   contact_name_sst     varchar(250) not null,
   contact_phone_sst    varchar(20) not null,
   logo_sst             varchar(100) not null,
   slogan_sst           varchar(300),
   main_color_sst       varchar(7) not null,
   secondary_color_sst  varchar(7) not null
)
type = innodb;

/*==============================================================*/
/* Table: school_year                                           */
/*==============================================================*/
create table school_year
(
   serial_scy           int 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 not null,
   invoice_due_max_day_scy int,
   ministry_max_grade_scy decimal(6,2) not null,
   school_max_grade_scy decimal(6,2) not null,
   matriclule_process_scy enum('ACTIVE','INACTIVE') not null,
   invoice_start_date_scy date not null,
   invoice_number_scy   int not null,
   primary key (serial_scy)
)
type = innodb;

/*==============================================================*/
/* Table: section                                               */
/*==============================================================*/
create table section
(
   serial_set           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: section_by_year                                       */
/*==============================================================*/
create table section_by_year
(
   serial_scy           int not null,
   serial_set           int not null,
   status_sby           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_scy, serial_set)
)
type = innodb;

/*==============================================================*/
/* Table: shift                                                 */
/*==============================================================*/
create table shift
(
   serial_sft           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: skills                                                */
/*==============================================================*/
create table skills
(
   serial_skl           int not null auto_increment,
   description_skl      text not null,
   status_skl           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_skl)
)
type = innodb;

/*==============================================================*/
/* Table: specialty                                             */
/*==============================================================*/
create table specialty
(
   serial_spt           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: special_grade_change_log                              */
/*==============================================================*/
create table special_grade_change_log
(
   serial_usr           int,
   serial_chr           int,
   serial_ysg           int,
   serial_std           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   change_date_sgl      timestamp not null,
   last_grade_sgl       decimal(8,5) not null,
   comment_sgl          text
)
type = innodb;

/*==============================================================*/
/* Table: state                                                 */
/*==============================================================*/
create table state
(
   serial_ste           int not null auto_increment,
   serial_cou           int,
   name_ste             varchar(100) not null,
   status_ste           enum('ACTIVE','INACTIVE') default 'ACTIVE',
   primary key (serial_ste)
)
type = innodb;

/*==============================================================*/
/* Table: stock_request                                         */
/*==============================================================*/
create table stock_request
(
   serial_srq           int not null auto_increment,
   serial_udt           int,
   serial_usr           int,
   description_srq      text not null,
   request_date_srq     date not null,
   status_srq           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_srq)
)
type = innodb;

/*==============================================================*/
/* Table: student                                               */
/*==============================================================*/
create table student
(
   serial_std           int not null auto_increment,
   serial_ste           int,
   serial_usr           int not null,
   serial_nnt           int,
   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),
   gender_std           enum('MALE','FEMALE') not null,
   address_std          text,
   phone_std            varchar(30),
   type_std             enum('NEW','OLD') not null default 'NEW',
   email_std            varchar(256),
   status_std           enum('ACTIVE','INACTIVE','BLOCKED') not null default 'INACTIVE',
   lives_with_std       enum('PARENTS','MOTHER','FATHER','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER'),
   first_name_mother_std varchar(128),
   last_name_mother_std varchar(128),
   phone_mother_std     varchar(30),
   mobile_mother_std    varchar(30),
   office_phone_mother_std varchar(30),
   first_name_father_std varchar(128),
   last_name_father_std varchar(128),
   phone_father_std     varchar(30),
   mobile_father_std    varchar(30),
   office_phone_father_std varchar(30),
   primary key (serial_std)
)
type = innodb;

/*==============================================================*/
/* Table: student_activity_attachment                           */
/*==============================================================*/
create table student_activity_attachment
(
   serial_saa           int not null auto_increment,
   name_saa             varchar(256) not null,
   filename_saa         varchar(256) not null,
   serial_std           int,
   serial_act           int,
   status_saa           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_saa)
)
type = innodb;

/*==============================================================*/
/* Table: student_by_course                                     */
/*==============================================================*/
create table student_by_course
(
   serial_std           int not null,
   serial_crs           int not null,
   status_stc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_std, serial_crs)
)
type = innodb;

/*==============================================================*/
/* Table: student_criteria_grade                                */
/*==============================================================*/
create table student_criteria_grade
(
   serial_sbc           int not null,
   serial_att           int not null,
   serial_prd           int not null,
   serial_gct           int not null,
   serial_act           int not null,
   serial_std           int not null,
   serial_crs           int 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),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: student_guardian                                      */
/*==============================================================*/
create table student_guardian
(
   serial_std           int not null,
   serial_grd           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: student_optional_subject                              */
/*==============================================================*/
create table student_optional_subject
(
   serial_osb           int not null,
   serial_std           int not null,
   serial_prd           int not null,
   serial_lop           int not null,
   status_sos           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_osb, serial_std, serial_prd, serial_lop)
)
type = innodb;

/*==============================================================*/
/* Table: student_period_comment                                */
/*==============================================================*/
create table student_period_comment
(
   serial_std           int,
   serial_prd           int,
   comment_spc          text not null,
   serial_usr           int,
   serial_crs           int
)
type = innodb;

/*==============================================================*/
/* Table: student_period_exam                                   */
/*==============================================================*/
create table student_period_exam
(
   serial_spx           int not null,
   serial_std           int not null,
   grade_stx            decimal(8,5),
   status_stx           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_spx, serial_std)
)
type = innodb;

/*==============================================================*/
/* Table: student_period_subject_skill_grade                    */
/*==============================================================*/
create table student_period_subject_skill_grade
(
   serial_ssg           int not null auto_increment,
   serial_osc           int,
   serial_yss           int,
   serial_std           int,
   serial_prd           int,
   serial_lsc           int,
   status_ssg           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ssg)
)
type = innodb;

/*==============================================================*/
/* Table: student_subject_period_average                        */
/*==============================================================*/
create table student_subject_period_average
(
   serial_ssa           int not null auto_increment,
   stu_serial_ssa       int,
   serial_lop           int,
   serial_sbc           int,
   serial_prd           int,
   serial_std           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   average_ssa          decimal(8,5),
   primary key (serial_ssa)
)
type = innodb;

/*==============================================================*/
/* Table: student_year                                          */
/*==============================================================*/
create table student_year
(
   folio_number_sty     varchar(20),
   matricule_number_sty varchar(20),
   is_listener_sty      enum('YES','NO') not null default 'NO',
   comment_sty          text,
   serial_std           int not null,
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   serial_pag           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: student_year_debts                                    */
/*==============================================================*/
create table student_year_debts
(
   serial_deb           int not null auto_increment,
   serial_std           int,
   serial_ypc           int,
   serial_pct           int,
   total_deb            decimal(10,2) not null,
   total_taxes_deb      decimal(10,2) not null,
   article_quantity_deb decimal(6,2),
   start_date_deb       date not null,
   status_deb           enum('PENDING','PAID','INACTIVE') not null default 'PENDING',
   primary key (serial_deb)
)
type = innodb;

/*==============================================================*/
/* Table: student_year_discount                                 */
/*==============================================================*/
create table student_year_discount
(
   serial_std           int not null,
   serial_ydc           int not null,
   status_syn           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_std, serial_ydc)
)
type = innodb;

/*==============================================================*/
/* Table: student_year_discount_values                          */
/*==============================================================*/
create table student_year_discount_values
(
   serial_sva           int not null auto_increment,
   serial_pct           int,
   serial_std           int,
   serial_ydc           int,
   discount_month_ydv   char(3) not null,
   value_ydv            decimal(10,2) not null,
   comment_ydv          varchar(128),
   status_ydv           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_sva)
)
type = innodb;

/*==============================================================*/
/* Table: student_year_document                                 */
/*==============================================================*/
create table student_year_document
(
   serial_yqd           int not null,
   serial_std           int not null,
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   delivered_syd        enum('YES','NO') not null default 'NO',
   filename_syd         varchar(1024),
   status_syd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_yqd, serial_std, serial_spt, serial_lvl, serial_scy, serial_set)
)
type = innodb;

/*==============================================================*/
/* Table: student_year_special_grade                            */
/*==============================================================*/
create table student_year_special_grade
(
   serial_ysg           int not null,
   serial_std           int not null,
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   grade_sys            decimal(8,5),
   status_sys           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ysg, serial_std, serial_spt, serial_lvl, serial_scy, serial_set)
)
type = innodb;

/*==============================================================*/
/* Table: study_place                                           */
/*==============================================================*/
create table study_place
(
   serial_stp           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: subject                                               */
/*==============================================================*/
create table subject
(
   serial_sbj           int not null auto_increment,
   serial_csb           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   status_sbj           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_sbj)
)
type = innodb;

/*==============================================================*/
/* Table: subject_course                                        */
/*==============================================================*/
create table subject_course
(
   serial_sbc           int not null auto_increment,
   serial_sbj           int,
   serial_crs           int,
   serial_aca           int,
   serial_emp           int,
   status_sbc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   grade_type_sbc       enum('QUALITATIVE','QUANTITATIVE') not null default 'QUANTITATIVE',
   hours_week_sbc       int not null,
   hours_distribution_sbc varchar(512),
   primary key (serial_sbc)
)
type = innodb;

/*==============================================================*/
/* Table: subject_course_period                                 */
/*==============================================================*/
create table subject_course_period
(
   serial_prd           int not null,
   serial_sbc           int not null,
   status_scp           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   weight_scp           decimal(5,2),
   primary key (serial_prd, serial_sbc)
)
type = innodb;

/*==============================================================*/
/* Table: subject_course_retest                                 */
/*==============================================================*/
create table subject_course_retest
(
   serial_scr           int not null auto_increment,
   serial_prd           int,
   serial_sbc           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: subject_course_retest_student                         */
/*==============================================================*/
create table subject_course_retest_student
(
   serial_std           int not null,
   serial_scr           int not null,
   grade_srg            decimal(8,5) not null,
   status_srg           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_std, serial_scr)
)
type = innodb;

/*==============================================================*/
/* Table: subject_level_restriction                             */
/*==============================================================*/
create table subject_level_restriction
(
   serial_hbg           int,
   serial_sbc           int,
   serial_lop           int,
   status_slr           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: subject_ministry_equivalence                          */
/*==============================================================*/
create table subject_ministry_equivalence
(
   serial_lop           int,
   serial_emp           int,
   serial_msb           int,
   serial_csb           int,
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   status_sme           enum('ACTIVE','INACTIVE') not null default 'ACTIVE'
)
type = innodb;

/*==============================================================*/
/* Table: subject_period_activity_type                          */
/*==============================================================*/
create table subject_period_activity_type
(
   serial_att           int not null,
   serial_prd           int not null,
   serial_sbc           int not null,
   weight_spa           decimal(5,2),
   due_min_days_spa     int not null,
   due_max_grade_spa    int not null,
   status_spa           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_att, serial_prd, serial_sbc)
)
type = innodb;

/*==============================================================*/
/* Table: subject_period_exam                                   */
/*==============================================================*/
create table subject_period_exam
(
   serial_spx           int not null auto_increment,
   serial_sbc           int,
   serial_osb           int,
   serial_ype           int,
   status_spx           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_spx)
)
type = innodb;

/*==============================================================*/
/* Table: subject_retest_change_log                             */
/*==============================================================*/
create table subject_retest_change_log
(
   serial_usr           int,
   serial_chr           int,
   serial_std           int,
   serial_scr           int,
   change_date_srl      timestamp not null,
   last_grade_srl       decimal(8,5) not null,
   comment_srl          text
)
type = innodb;

/*==============================================================*/
/* Table: subject_year_activity_criteria_period                 */
/*==============================================================*/
create table subject_year_activity_criteria_period
(
   serial_att           int not null,
   serial_prd           int not null,
   serial_sbc           int not null,
   serial_sbj           int not null,
   serial_gct           int not null,
   status_acp           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_att, serial_prd, serial_sbc, serial_sbj, serial_gct)
)
type = innodb;

/*==============================================================*/
/* Table: subject_year_grade_criteria                           */
/*==============================================================*/
create table subject_year_grade_criteria
(
   serial_sbj           int not null,
   serial_gct           int not null,
   status_sgc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_sbj, serial_gct)
)
type = innodb;

/*==============================================================*/
/* Table: subperiod                                             */
/*==============================================================*/
create table subperiod
(
   serial_sbp           int not null auto_increment,
   serial_prd           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: syllabus_files                                        */
/*==============================================================*/
create table syllabus_files
(
   serial_syf           int not null auto_increment,
   serial_sbc           int,
   serial_osb           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: syllabus_files_change_log                             */
/*==============================================================*/
create table syllabus_files_change_log
(
   serial_syf           int,
   serial_usr           int,
   change_date_scl      timestamp not null,
   old_data_scl         text not null
)
type = innodb;

/*==============================================================*/
/* Table: taxes                                                 */
/*==============================================================*/
create table taxes
(
   serial_tax           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: teacher_degree                                        */
/*==============================================================*/
create table teacher_degree
(
   serial_tdg           int not null auto_increment,
   name_tdg             varchar(255) not null,
   status_tdg           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_tdg)
)
type = innodb;

/*==============================================================*/
/* Table: teacher_hours_year                                    */
/*==============================================================*/
create table teacher_hours_year
(
   serial_thy           int not null auto_increment,
   serial_emp           int,
   serial_scy           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: teacher_master_degree                                 */
/*==============================================================*/
create table teacher_master_degree
(
   serial_tmd           int not null auto_increment,
   name_tmd             varchar(255) not null,
   status_tmd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_tmd)
)
type = innodb;

/*==============================================================*/
/* Table: teacher_specialty                                     */
/*==============================================================*/
create table teacher_specialty
(
   serial_tst           int not null auto_increment,
   name_tst             varchar(255) not null,
   status_tst           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_tst)
)
type = innodb;

/*==============================================================*/
/* Table: university                                            */
/*==============================================================*/
create table university
(
   serial_unv           int not null auto_increment,
   name_unv             varchar(255) not null,
   status_unv           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_unv)
)
type = innodb;

/*==============================================================*/
/* Table: user                                                  */
/*==============================================================*/
create table user
(
   serial_usr           int not null auto_increment,
   serial_emp           int,
   serial_grd           int,
   use_serial_usr       int,
   serial_std           int,
   username_usr         varchar(150) not null,
   password_usr         varchar(300),
   photo_usr            varchar(1024),
   status_usr           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_usr)
)
type = innodb;

/*==============================================================*/
/* Table: user_course_comment_setup                             */
/*==============================================================*/
create table user_course_comment_setup
(
   serial_usr           int not null,
   serial_crs           int not null,
   status_cpc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_usr, serial_crs)
)
type = innodb;

/*==============================================================*/
/* Table: user_profile                                          */
/*==============================================================*/
create table user_profile
(
   serial_usr           int not null,
   serial_prf           int not null,
   status_upr           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_usr, serial_prf)
)
type = innodb;

/*==============================================================*/
/* Table: use_destination                                       */
/*==============================================================*/
create table use_destination
(
   serial_udt           int 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)
)
type = innodb;

/*==============================================================*/
/* Table: visits_medical_center                                 */
/*==============================================================*/
create table visits_medical_center
(
   serial_vmc           int not null auto_increment,
   serial_mdf           int,
   date_vmc             date not null,
   reason_vmc           text not null,
   diagnosis_vmc        text not null,
   filename_att_vmc     varchar(100),
   attachment_vmc       varchar(100),
   height_vmc           decimal(3,2),
   weight_vmc           decimal(3,2),
   primary key (serial_vmc)
)
type = innodb;

/*==============================================================*/
/* Table: web_pre_registration                                  */
/*==============================================================*/
create table web_pre_registration
(
   serial_wpr           int not null auto_increment,
   serial_wus           int,
   serial_nnt           int,
   serial_dgr           int,
   serial_ste           int,
   id_wpr               varchar(10),
   serial_spt           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   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),
   last_name_father_wpr varchar(100),
   first_name_mother_wpr varchar(100),
   last_name_mother_wpr varchar(100),
   city_birth_wpr       varchar(100),
   blood_type_wpr       varchar(10),
   allergies_wpr        text,
   lives_with_wpr       enum('PARENT','SIBLING','GRANDPARENT','AUNT_UNCLE','OTHER') not null,
   photo_wpr            varchar(1024),
   email_wpr            varchar(256),
   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,
   rep_city_birth_wpr   varchar(100),
   rep_marital_status_wpr enum('SINGLE','MARRIED','DIVORCED','WIDOWED','UNMARRIED PARTNERS') not null,
   rep_occupation_wpr   varchar(100),
   rep_address_wpr      text not null,
   rep_phone_wpr        varchar(13) not null,
   rep_mobile_wpr       varchar(13),
   rep_company_name_wpr varchar(80),
   rep_company_activity_wpr text,
   rep_company_phone_wpr varchar(13),
   rep_photo_wpr        varchar(1024),
   rep_gender_wpr       enum('MALE','FEMALE') not null,
   rep_id_wpr           varchar(13) not null,
   rep_email_wpr        varchar(256),
   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)
)
type = innodb;

/*==============================================================*/
/* Table: web_user                                              */
/*==============================================================*/
create table web_user
(
   serial_wus           int 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),
   company_name_wus     varchar(100),
   company_activity_wus varchar(80),
   company_phone_wus    varchar(13),
   email_wus            varchar(128) not null,
   password_wus         varchar(256) not null,
   authentication_key_wus varchar(1024) not null,
   primary key (serial_wus)
)
type = innodb;

/*==============================================================*/
/* Table: year_concept_taxes                                    */
/*==============================================================*/
create table year_concept_taxes
(
   serial_ypc           int,
   serial_tax           int,
   value_yct            decimal(5,2),
   status_yct           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   serial_pct           int
)
type = innodb;

/*==============================================================*/
/* Table: year_discount                                         */
/*==============================================================*/
create table year_discount
(
   serial_ydc           int not null auto_increment,
   serial_dsc           int,
   serial_scy           int,
   type_ydc             enum('PERCENTAGE','FIXED') not null,
   value_ydc            decimal(10,2) not null,
   days_before_limit_ydc int,
   status_ydc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ydc)
)
type = innodb;

/*==============================================================*/
/* Table: year_grade_subject                                    */
/*==============================================================*/
create table year_grade_subject
(
   serial_ygs           int not null auto_increment,
   serial_scy           int,
   serial_csb           int,
   status_ygs           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ygs)
)
type = innodb;

/*==============================================================*/
/* Table: year_level_specialty_payment_concept                  */
/*==============================================================*/
create table year_level_specialty_payment_concept
(
   serial_ypc           int not null auto_increment,
   serial_art           int,
   serial_pct           int not null,
   serial_spt           int not null,
   serial_lvl           int not null,
   serial_scy           int not null,
   serial_set           int not null,
   value_ypc            decimal(10,2) not null,
   frequency_ypc        enum('ANNUAL','MONTHLY') not null,
   repetitions_number_ypc int 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)
)
type = innodb;

/*==============================================================*/
/* Table: year_period_exam_setup                                */
/*==============================================================*/
create table year_period_exam_setup
(
   serial_ype           int not null auto_increment,
   serial_prd           int,
   serial_lvl           int,
   serial_scy           int,
   serial_set           int,
   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)
)
type = innodb;

/*==============================================================*/
/* Table: year_pre_registration_document                        */
/*==============================================================*/
create table year_pre_registration_document
(
   serial_ypd           int not null auto_increment,
   serial_scy           int,
   serial_qdc           int,
   status_ypd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ypd)
)
type = innodb;

/*==============================================================*/
/* Table: year_qualifying_document                              */
/*==============================================================*/
create table year_qualifying_document
(
   serial_yqd           int not null auto_increment,
   serial_scy           int,
   serial_qdc           int,
   status_yqd           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_yqd)
)
type = innodb;

/*==============================================================*/
/* Table: year_report_comment                                   */
/*==============================================================*/
create table year_report_comment
(
   serial_yrc           int not null auto_increment,
   serial_scy           int,
   serial_std           int,
   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,
   comment_yrc          text not null,
   primary key (serial_yrc)
)
type = innodb;

/*==============================================================*/
/* Table: year_resit_exam_ranges                                */
/*==============================================================*/
create table year_resit_exam_ranges
(
   serial_yre           int not null auto_increment,
   serial_scy           int,
   lower_limit_yre      decimal(8,5) not null,
   higher_limit_yre     decimal(8,5) 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)
)
type = innodb;

/*==============================================================*/
/* Table: year_special_grade                                    */
/*==============================================================*/
create table year_special_grade
(
   serial_ysg           int not null auto_increment,
   serial_scy           int,
   name_ysg             varchar(256) not null,
   description_ysg      text not null,
   status_ysg           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ysg)
)
type = innodb;

/*==============================================================*/
/* Table: year_subject_classroom                                */
/*==============================================================*/
create table year_subject_classroom
(
   serial_ysc           int not null auto_increment,
   serial_sbc           int,
   serial_clr           int,
   serial_osb           int,
   status_ysc           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_ysc)
)
type = innodb;

/*==============================================================*/
/* Table: year_subject_skills                                   */
/*==============================================================*/
create table year_subject_skills
(
   serial_yss           int not null auto_increment,
   serial_osb           int,
   serial_skl           int,
   serial_sbc           int,
   status_yss           enum('ACTIVE','INACTIVE') not null default 'ACTIVE',
   primary key (serial_yss)
)
type = innodb;

alter table access_log add constraint fk_relationship_143 foreign key (serial_usr, serial_prf)
      references user_profile (serial_usr, serial_prf) on delete restrict on update restrict;

alter table activity_applied_criterias add constraint fk_activity_header foreign key (serial_act)
      references activity (serial_act) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table activity_attachment add constraint fk_relationship_96 foreign key (serial_act)
      references activity (serial_act) on delete restrict on update restrict;

alter table activity_policy_violations add constraint fk_relationship_146 foreign key (serial_act)
      references activity (serial_act) on delete restrict on update restrict;

alter table activity_policy_violations add constraint fk_relationship_147 foreign key (serial_opa)
      references opt_activity (serial_opa) on delete restrict on update restrict;

alter table activity_policy_violations add constraint fk_relationship_148 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table allowed_pages_by_process add constraint fk_child_pages foreign key (serial_prc)
      references process (serial_prc) on delete restrict on update restrict;

alter table attendance add constraint fk_relationship_289 foreign key (serial_scd)
      references schedule (serial_scd) on delete restrict on update restrict;

alter table attendance add constraint fk_relationship_290 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table authority add constraint fk_has_charge foreign key (serial_atc)
      references authority_charge (serial_atc) on delete restrict on update restrict;

alter table autoschedule_process add constraint fk_relationship_293 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table autoschedule_process add constraint fk_relationship_294 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table autoschedule_process_results add constraint fk_relationship_295 foreign key (serial_asp)
      references autoschedule_process (serial_asp) on delete restrict on update restrict;

alter table autoschedule_process_results add constraint fk_relationship_296 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table autoschedule_process_results add constraint fk_relationship_297 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table autoschedule_process_results add constraint fk_relationship_298 foreign key (serial_clr)
      references classroom (serial_clr) on delete restrict on update restrict;

alter table autoschedule_process_results add constraint fk_relationship_299 foreign key (serial_crs)
      references course (serial_crs) on delete restrict on update restrict;

alter table autoschedule_process_results add constraint fk_relationship_300 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table autoschedule_process_results add constraint fk_relationship_301 foreign key (serial_cdt)
      references credits_detail (serial_cdt) on delete restrict on update restrict;

alter table book add constraint fk_relationship_271 foreign key (serial_bct)
      references book_category (serial_bct) on delete restrict on update restrict;

alter table book add constraint fk_relationship_272 foreign key (serial_lst)
      references library_section (serial_lst) on delete restrict on update restrict;

alter table book_author add constraint fk_relationship_273 foreign key (serial_atr)
      references author (serial_atr) on delete restrict on update restrict;

alter table book_author add constraint fk_relationship_274 foreign key (serial_bok)
      references book (serial_bok) on delete restrict on update restrict;

alter table book_category add constraint fk_relationship_270 foreign key (boo_serial_bct)
      references book_category (serial_bct) on delete restrict on update restrict;

alter table book_copy add constraint fk_relationship_275 foreign key (serial_bok)
      references book (serial_bok) on delete restrict on update restrict;

alter table bus_shift_year add constraint fk_relationship_76 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table bus_shift_year add constraint fk_relationship_77 foreign key (serial_bdr)
      references bus_driver (serial_bdr) on delete restrict on update restrict;

alter table bus_shift_year add constraint fk_relationship_78 foreign key (serial_bus)
      references bus (serial_bus) on delete restrict on update restrict;

alter table bus_shift_year add constraint fk_relationship_79 foreign key (serial_rot)
      references route (serial_rot) on delete restrict on update restrict;

alter table bus_shift_year add constraint fk_relationship_80 foreign key (serial_sft)
      references shift (serial_sft) on delete restrict on update restrict;

alter table bus_shift_year add constraint fk_relationship_81 foreign key (bus_serial_bdr)
      references bus_driver (serial_bdr) on delete restrict on update restrict;

alter table bus_year_user 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) on delete restrict on update restrict;

alter table bus_year_user add constraint fk_relationship_98 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table cat_subject add constraint fk_child_parent foreign key (cat_serial_csb)
      references cat_subject (serial_csb) on delete restrict on update restrict;

alter table cat_subject add constraint fk_relationship_62 foreign key (serial_aca)
      references academic_area (serial_aca) on delete restrict on update restrict;

alter table cat_subject add constraint fk_relationship_68 foreign key (serial_lng)
      references language (serial_lng) on delete restrict on update restrict;

alter table course add constraint fk_selected_class foreign key (serial_clg)
      references class_group (serial_clg) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table course_director add constraint fk_relationship_144 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table course_director add constraint fk_relationship_145 foreign key (serial_crs)
      references course (serial_crs) on delete restrict on update restrict;

alter table credits_detail add constraint fk_relationship_269 foreign key (serial_hrs)
      references hour (serial_hrs) on delete restrict on update restrict;

alter table current_deferred add constraint fk_relationship_338 foreign key (serial_fic)
      references financial_institution_card (serial_fic) on delete restrict on update restrict;

alter table current_deferred add constraint fk_relationship_340 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table discipline 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) on delete restrict on update restrict;

alter table discipline add constraint fk_relationship_131 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table discount_payment_concept add constraint fk_relationship_226 foreign key (serial_ydc)
      references year_discount (serial_ydc) on delete restrict on update restrict;

alter table discount_payment_concept add constraint fk_relationship_227 foreign key (serial_pct)
      references payment_concept (serial_pct) on delete restrict on update restrict;

alter table employee add constraint fk_employee_birth_country foreign key (serial_cou)
      references country (serial_cou) on delete restrict on update restrict;

alter table employee add constraint fk_employee_birth_state foreign key (serial_ste)
      references state (serial_ste) on delete restrict on update restrict;

alter table employee add constraint fk_employee_guardian2 foreign key (serial_grd)
      references guardian (serial_grd) on delete restrict on update restrict;

alter table employee add constraint fk_employee_user foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table employee add constraint fk_relationship_54 foreign key (serial_nnt)
      references nationality (serial_nnt) on delete restrict on update restrict;

alter table employee add constraint fk_relationship_55 foreign key (serial_tdg)
      references teacher_degree (serial_tdg) on delete restrict on update restrict;

alter table employee add constraint fk_relationship_56 foreign key (serial_tmd)
      references teacher_master_degree (serial_tmd) on delete restrict on update restrict;

alter table employee add constraint fk_relationship_57 foreign key (serial_tst)
      references teacher_specialty (serial_tst) on delete restrict on update restrict;

alter table employee add constraint fk_relationship_58 foreign key (serial_dgr)
      references degree (serial_dgr) on delete restrict on update restrict;

alter table employee add constraint fk_relationship_59 foreign key (serial_mdg)
      references master_degree (serial_mdg) on delete restrict on update restrict;

alter table employee add constraint fk_relationship_60 foreign key (serial_unv)
      references university (serial_unv) on delete restrict on update restrict;

alter table employee_area add constraint fk_area_by_employee foreign key (serial_aca)
      references academic_area (serial_aca) on delete restrict on update restrict;

alter table employee_area add constraint fk_employee_in_area foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table financial_institution_card add constraint fk_relationship_336 foreign key (serial_ccd)
      references credit_card (serial_ccd) on delete restrict on update restrict;

alter table financial_institution_card add constraint fk_relationship_337 foreign key (serial_fin)
      references financial_institution (serial_fin) on delete restrict on update restrict;

alter table general_activity_attendees add constraint fk_relationship_139 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table general_activity_attendees add constraint fk_relationship_140 foreign key (serial_gac)
      references general_activity (serial_gac) on delete restrict on update restrict;

alter table general_discipline_log add constraint fk_relationship_151 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table general_discipline_log 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) on delete restrict on update restrict;

alter table general_discipline_log add constraint fk_relationship_153 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table grade_change_log 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) on delete restrict on update restrict;

alter table grade_change_log add constraint fk_relationship_124 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table grade_change_log add constraint fk_relationship_150 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table grade_score_change_log add constraint fk_relationship_237 foreign key (serial_ygs, serial_std)
      references grade_subject_score (serial_ygs, serial_std) on delete restrict on update restrict;

alter table grade_score_change_log add constraint fk_relationship_238 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table grade_score_change_log add constraint fk_relationship_239 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table grade_subject_score add constraint fk_relationship_176 foreign key (serial_ygs)
      references year_grade_subject (serial_ygs) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table group_hour_level add constraint fk_group_hour_for_level foreign key (serial_gph)
      references group_hour (serial_gph) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table group_optional_subject add constraint fk_relationship_281 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table group_optional_subject add constraint fk_relationship_282 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table guardian add constraint fk_employee_guardian foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table guardian add constraint fk_guardian_user foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table hour_by_group add constraint fk_for_group foreign key (serial_gph)
      references group_hour (serial_gph) on delete restrict on update restrict;

alter table hour_by_group add constraint fk_is_in_group foreign key (serial_hrs)
      references hour (serial_hrs) on delete restrict on update restrict;

alter table incident add constraint fk_relationship_194 foreign key (use_serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table incident add constraint fk_relationship_195 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table income_stock add constraint fk_relationship_184 foreign key (serial_prv)
      references provider (serial_prv) on delete restrict on update restrict;

alter table income_stock add constraint fk_relationship_185 foreign key (serial_mti)
      references maintenance_item (serial_mti) on delete restrict on update restrict;

alter table income_stock add constraint fk_relationship_186 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table invoice_detail add constraint fk_relationship_155 foreign key (serial_phy)
      references invoice (serial_phy) on delete restrict on update restrict;

alter table invoice_detail add constraint fk_relationship_156 foreign key (serial_deb)
      references student_year_debts (serial_deb) on delete restrict on update restrict;

alter table invoice_detail add constraint fk_relationship_171 foreign key (serial_cdf)
      references current_deferred (serial_cdf) on delete restrict on update restrict;

alter table invoice_detail add constraint fk_relationship_231 foreign key (serial_sva)
      references student_year_discount_values (serial_sva) on delete restrict on update restrict;

alter table invoice_detail_non_academic add constraint fk_relationship_328 foreign key (serial_ina)
      references invoice_non_academic (serial_ina) on delete restrict on update restrict;

alter table invoice_detail_non_academic add constraint fk_relationship_329 foreign key (serial_deb)
      references student_year_debts (serial_deb) on delete restrict on update restrict;

alter table invoice_detail_non_academic add constraint fk_relationship_330 foreign key (serial_sva)
      references student_year_discount_values (serial_sva) on delete restrict on update restrict;

alter table invoice_detail_non_academic add constraint fk_relationship_331 foreign key (serial_cdf)
      references current_deferred (serial_cdf) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table level_optional_group_detail add constraint fk_relationship_244 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table level_optional_group_detail add constraint fk_relationship_245 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table level_opt_skill_criteria add constraint fk_relationship_319 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table level_section_year add constraint fk_level_in_section foreign key (serial_lvl)
      references level (serial_lvl) on delete restrict on update restrict;

alter table level_section_year add constraint fk_period_group_level foreign key (serial_pgy)
      references period_group_year (serial_pgy) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table level_section_year_specialty add constraint fk_selected_level foreign key (serial_lvl, serial_scy, serial_set)
      references level_section_year (serial_lvl, serial_scy, serial_set) on delete restrict on update restrict;

alter table level_section_year_specialty add constraint fk_selected_specialty foreign key (serial_spt)
      references specialty (serial_spt) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table loan add constraint fk_relationship_280 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table loan_detail add constraint fk_relationship_276 foreign key (serial_eqt)
      references equipment (serial_eqt) on delete restrict on update restrict;

alter table loan_detail add constraint fk_relationship_277 foreign key (serial_stp)
      references study_place (serial_stp) on delete restrict on update restrict;

alter table loan_detail add constraint fk_relationship_278 foreign key (serial_bkc)
      references book_copy (serial_bkc) on delete restrict on update restrict;

alter table loan_detail add constraint fk_relationship_279 foreign key (serial_loa)
      references loan (serial_loa) on delete restrict on update restrict;

alter table maintenance_item add constraint fk_relationship_183 foreign key (serial_ict)
      references item_category (serial_ict) on delete restrict on update restrict;

alter table medical_file add constraint fk_relationship_196 foreign key (serial_gst)
      references guest (serial_gst) on delete restrict on update restrict;

alter table medical_file add constraint fk_relationship_65 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table message add constraint fk_relationship_136 foreign key (serial_usr_send)
      references user (serial_usr) on delete restrict on update restrict;

alter table message add constraint fk_relationship_137 foreign key (serial_usr_receive)
      references user (serial_usr) on delete restrict on update restrict;

alter table message add constraint fk_relationship_154 foreign key (serial_prf)
      references profile (serial_prf) on delete restrict on update restrict;

alter table message_between_profiles add constraint fk_relationship_141 foreign key (serial_prf)
      references profile (serial_prf) on delete restrict on update restrict;

alter table message_between_profiles add constraint fk_relationship_142 foreign key (pro_serial_prf)
      references profile (serial_prf) on delete restrict on update restrict;

alter table message_thread add constraint fk_relationship_138 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table message_thread_messages add constraint fk_relationship_134 foreign key (serial_mth)
      references message_thread (serial_mth) on delete restrict on update restrict;

alter table message_thread_messages add constraint fk_relationship_135 foreign key (serial_msg)
      references message (serial_msg) on delete restrict on update restrict;

alter table ministry_resit_change_log 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) on delete restrict on update restrict;

alter table ministry_resit_change_log add constraint fk_relationship_257 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table ministry_resit_change_log add constraint fk_relationship_258 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table ministry_resit_student 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) on delete restrict on update restrict;

alter table ministry_resit_student add constraint fk_relationship_256 foreign key (serial_msb)
      references ministry_subject (serial_msb) on delete restrict on update restrict;

alter table optional_subject add constraint fk_relationship_116 foreign key (per_serial_pgy)
      references period_group_year (serial_pgy) on delete restrict on update restrict;

alter table optional_subject add constraint fk_relationship_127 foreign key (serial_aca, serial_emp)
      references employee_area (serial_aca, serial_emp) on delete restrict on update restrict;

alter table optional_subject add constraint fk_relationship_249 foreign key (serial_pgy)
      references period_group_year (serial_pgy) on delete restrict on update restrict;

alter table optional_subject add constraint fk_relationship_53 foreign key (serial_csb)
      references cat_subject (serial_csb) on delete restrict on update restrict;

alter table optional_subject_level 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) on delete restrict on update restrict;

alter table optional_subject_level add constraint fk_relationship_105 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table optional_subject_period add constraint fk_relationship_106 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table optional_subject_period add constraint fk_relationship_107 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table optional_subject_retest add constraint fk_relationship_198 foreign key (serial_prd, serial_osb)
      references optional_subject_period (serial_prd, serial_osb) on delete restrict on update restrict;

alter table optional_subject_retest_student add constraint fk_relationship_199 foreign key (serial_osr)
      references optional_subject_retest (serial_osr) on delete restrict on update restrict;

alter table optional_subject_retest_student add constraint fk_relationship_200 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table opt_activity_applied_criterias 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) on delete restrict on update restrict;

alter table opt_activity_applied_criterias add constraint fk_relationship_118 foreign key (serial_opa)
      references opt_activity (serial_opa) on delete restrict on update restrict;

alter table opt_activity_attachment add constraint fk_relationship_119 foreign key (serial_opa)
      references opt_activity (serial_opa) on delete restrict on update restrict;

alter table opt_grade_change_log 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) on delete restrict on update restrict;

alter table opt_grade_change_log add constraint fk_relationship_126 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table opt_grade_change_log add constraint fk_relationship_149 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

/*alter table opt_student_activity_attachment add constraint fk_relationship_122 foreign key (serial_opa, serial_std)
      references opt_student_criteria_grade (serial_opa, serial_std) on delete restrict on update restrict;

alter table opt_student_criteria_grade add constraint fk_relationship_120 foreign key (serial_std)
      references student_optional_subject (serial_std) on delete restrict on update restrict; */

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) on delete restrict on update restrict;

alter table opt_subject_period_activity_type add constraint fk_relationship_112 foreign key (serial_prd, serial_osb)
      references optional_subject_period (serial_prd, serial_osb) on delete restrict on update restrict;

alter table opt_subject_period_activity_type add constraint fk_relationship_113 foreign key (serial_att)
      references activity_type (serial_att) on delete restrict on update restrict;

alter table opt_subject_retest_change_log add constraint fk_relationship_215 foreign key (serial_std, serial_osr)
      references optional_subject_retest_student (serial_std, serial_osr) on delete restrict on update restrict;

alter table opt_subject_retest_change_log add constraint fk_relationship_216 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table opt_subject_retest_change_log add constraint fk_relationship_217 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table opt_subject_year_activity_criteria_period add constraint fk_relationship_114 foreign key (serial_att, serial_prd)
      references opt_subject_period_activity_type (serial_att, serial_prd) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table opt_subject_year_grade_criteria add constraint fk_relationship_110 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table opt_subject_year_grade_criteria add constraint fk_relationship_111 foreign key (serial_gct)
      references grade_criteria (serial_gct) on delete restrict on update restrict;

alter table payment_agreement_group add constraint fk_relationship_292 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table payment_detail add constraint fk_relationship_172 foreign key (serial_phy)
      references invoice (serial_phy) on delete restrict on update restrict;

alter table payment_detail add constraint fk_relationship_173 foreign key (serial_pym)
      references payment_method (serial_pym) on delete restrict on update restrict;

alter table payment_detail add constraint fk_relationship_191 foreign key (serial_ccd)
      references credit_card (serial_ccd) on delete restrict on update restrict;

alter table payment_detail add constraint fk_relationship_192 foreign key (serial_fin)
      references financial_institution (serial_fin) on delete restrict on update restrict;

alter table payment_detail_non_academic add constraint fk_relationship_332 foreign key (serial_ina)
      references invoice_non_academic (serial_ina) on delete restrict on update restrict;

alter table payment_detail_non_academic add constraint fk_relationship_333 foreign key (serial_fin)
      references financial_institution (serial_fin) on delete restrict on update restrict;

alter table payment_detail_non_academic add constraint fk_relationship_334 foreign key (serial_ccd)
      references credit_card (serial_ccd) on delete restrict on update restrict;

alter table payment_detail_non_academic add constraint fk_relationship_335 foreign key (serial_pym)
      references payment_method (serial_pym) on delete restrict on update restrict;

alter table period add constraint fk_periods_by_group foreign key (serial_pgy)
      references period_group_year (serial_pgy) on delete restrict on update restrict;

alter table period_exam_grade_change_log add constraint fk_relationship_310 foreign key (serial_spx, serial_std)
      references student_period_exam (serial_spx, serial_std) on delete restrict on update restrict;

alter table period_exam_grade_change_log add constraint fk_relationship_311 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table period_exam_grade_change_log add constraint fk_relationship_312 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table period_group_year add constraint fk_periods_in_year foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table period_group_year add constraint fk_period_for_year foreign key (serial_cpd)
      references cat_period (serial_cpd) on delete restrict on update restrict;

alter table pre_registration add constraint fk_registered_nationality foreign key (serial_nnt)
      references nationality (serial_nnt) on delete restrict on update restrict;

alter table pre_registration add constraint fk_relationship_241 foreign key (serial_ste)
      references state (serial_ste) on delete restrict on update restrict;

alter table pre_registration 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) on delete restrict on update restrict;

alter table pre_registration add constraint fk_relationship_67 foreign key (serial_dgr)
      references degree (serial_dgr) on delete restrict on update restrict;

alter table pre_registration add constraint fk_user_register foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table pre_registration_period add constraint fk_relationship_73 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table pre_registration_required_documment add constraint fk_relationship_263 foreign key (serial_ypd)
      references year_pre_registration_document (serial_ypd) on delete restrict on update restrict;

alter table pre_registration_required_documment add constraint fk_relationship_264 foreign key (serial_prt)
      references pre_registration (serial_prt) on delete restrict on update restrict;

alter table pre_registration_required_documment add constraint fk_relationship_265 foreign key (serial_wpr)
      references web_pre_registration (serial_wpr) on delete restrict on update restrict;

alter table process add constraint fk_parent_process foreign key (prc_serial_prc)
      references process (serial_prc) on delete restrict on update restrict;

alter table profile_process add constraint fk_has_process foreign key (serial_prf)
      references profile (serial_prf) on delete restrict on update restrict;

alter table profile_process add constraint fk_in_profile foreign key (serial_prc)
      references process (serial_prc) on delete restrict on update restrict;

alter table psychological_file add constraint fk_relationship_89 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table qualitative_equivalence add constraint fk_relationship_161 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table request_detail add constraint fk_relationship_188 foreign key (serial_ist)
      references income_stock (serial_ist) on delete restrict on update restrict;

alter table request_detail add constraint fk_relationship_189 foreign key (serial_srq)
      references stock_request (serial_srq) on delete restrict on update restrict;

alter table resit_change_log 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) on delete restrict on update restrict;

alter table resit_change_log add constraint fk_relationship_219 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table resit_change_log add constraint fk_relationship_220 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table resit_student 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) on delete restrict on update restrict;

alter table resit_student add constraint fk_relationship_211 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table schedule add constraint fk_relationship_283 foreign key (serial_cdt)
      references credits_detail (serial_cdt) on delete restrict on update restrict;

alter table schedule add constraint fk_relationship_284 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table schedule add constraint fk_relationship_285 foreign key (serial_crs)
      references course (serial_crs) on delete restrict on update restrict;

alter table schedule add constraint fk_relationship_286 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table schedule add constraint fk_relationship_287 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table schedule add constraint fk_relationship_288 foreign key (serial_clr)
      references classroom (serial_clr) on delete restrict on update restrict;

alter table school_setup add constraint fk_currency_for_school foreign key (serial_crr)
      references currency (serial_crr) on delete restrict on update restrict;

alter table school_setup add constraint fk_school_state foreign key (serial_ste)
      references state (serial_ste) on delete restrict on update restrict;

alter table section_by_year add constraint fk_section_in_year foreign key (serial_set)
      references section (serial_set) on delete restrict on update restrict;

alter table section_by_year add constraint fk_year_sections foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table special_grade_change_log 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) on delete restrict on update restrict;

alter table special_grade_change_log add constraint fk_relationship_222 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table special_grade_change_log add constraint fk_relationship_223 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table state add constraint fk_country_state foreign key (serial_cou)
      references country (serial_cou) on delete restrict on update restrict;

alter table stock_request add constraint fk_relationship_187 foreign key (serial_udt)
      references use_destination (serial_udt) on delete restrict on update restrict;

alter table stock_request add constraint fk_relationship_190 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table student add constraint fk_relationship_240 foreign key (serial_ste)
      references state (serial_ste) on delete restrict on update restrict;

alter table student add constraint fk_relationship_61 foreign key (serial_nnt)
      references nationality (serial_nnt) on delete restrict on update restrict;

alter table student add constraint fk_student_user foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

/*alter table student_activity_attachment add constraint fk_relationship_101 foreign key (serial_std, serial_act)
      references student_criteria_grade (serial_std, serial_act) on delete restrict on update restrict;*/

alter table student_by_course add constraint fk_course_for_student foreign key (serial_crs)
      references course (serial_crs) on delete restrict on update restrict;

alter table student_by_course add constraint fk_student_in_course foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table student_criteria_grade add constraint fk_relationship_100 foreign key (serial_std, serial_crs)
      references student_by_course (serial_std, serial_crs) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table student_guardian add constraint fk_has_guardian foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table student_guardian add constraint fk_is_guardian foreign key (serial_grd)
      references guardian (serial_grd) on delete restrict on update restrict;

alter table student_optional_subject add constraint fk_relationship_108 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table student_optional_subject add constraint fk_relationship_109 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table student_period_comment add constraint fk_relationship_315 foreign key (serial_usr, serial_crs)
      references user_course_comment_setup (serial_usr, serial_crs) on delete restrict on update restrict;

alter table student_period_comment add constraint fk_relationship_316 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table student_period_comment add constraint fk_relationship_318 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table student_period_exam add constraint fk_relationship_308 foreign key (serial_spx)
      references subject_period_exam (serial_spx) on delete restrict on update restrict;

alter table student_period_exam add constraint fk_relationship_309 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table student_period_subject_skill_grade add constraint fk_relationship_323 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table student_period_subject_skill_grade add constraint fk_relationship_324 foreign key (serial_yss)
      references year_subject_skills (serial_yss) on delete restrict on update restrict;

alter table student_period_subject_skill_grade add constraint fk_relationship_325 foreign key (serial_osc)
      references level_opt_skill_criteria (serial_osc) on delete restrict on update restrict;

alter table student_period_subject_skill_grade add constraint fk_relationship_326 foreign key (serial_lsc)
      references level_skill_grade_criteria (serial_lsc) on delete restrict on update restrict;

alter table student_period_subject_skill_grade add constraint fk_relationship_327 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table student_subject_period_average add constraint fk_relationship_248 foreign key (stu_serial_ssa)
      references student_subject_period_average (serial_ssa) on delete restrict on update restrict;

alter table student_subject_period_average add constraint fk_relationship_250 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table student_subject_period_average add constraint fk_relationship_251 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table student_subject_period_average 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) on delete restrict on update restrict;

alter table student_subject_period_average add constraint fk_relationship_253 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table student_year add constraint fk_relationship_291 foreign key (serial_pag)
      references payment_agreement_group (serial_pag) on delete restrict on update restrict;

alter table student_year add constraint fk_relationship_74 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table student_year_debts add constraint fk_relationship_102 foreign key (serial_ypc)
      references year_level_specialty_payment_concept (serial_ypc) on delete restrict on update restrict;

alter table student_year_debts add constraint fk_relationship_103 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table student_year_discount add constraint fk_relationship_228 foreign key (serial_ydc)
      references year_discount (serial_ydc) on delete restrict on update restrict;

alter table student_year_discount add constraint fk_relationship_229 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table student_year_discount_values add constraint fk_relationship_230 foreign key (serial_std, serial_ydc)
      references student_year_discount (serial_std, serial_ydc) on delete restrict on update restrict;

alter table student_year_discount_values add constraint fk_relationship_235 foreign key (serial_pct)
      references payment_concept (serial_pct) on delete restrict on update restrict;

alter table student_year_document 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) on delete restrict on update restrict;

alter table student_year_document add constraint fk_relationship_160 foreign key (serial_yqd)
      references year_qualifying_document (serial_yqd) on delete restrict on update restrict;

alter table student_year_special_grade add constraint fk_relationship_179 foreign key (serial_ysg)
      references year_special_grade (serial_ysg) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table subject 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) on delete restrict on update restrict;

alter table subject add constraint fk_year_subject foreign key (serial_csb)
      references cat_subject (serial_csb) on delete restrict on update restrict;

alter table subject_course add constraint fk_course_with_subject foreign key (serial_crs)
      references course (serial_crs) on delete restrict on update restrict;

alter table subject_course add constraint fk_is_teacher foreign key (serial_aca, serial_emp)
      references employee_area (serial_aca, serial_emp) on delete restrict on update restrict;

alter table subject_course add constraint fk_subject_for_course foreign key (serial_sbj)
      references subject (serial_sbj) on delete restrict on update restrict;

alter table subject_course_period add constraint fk_relationship_71 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table subject_course_period add constraint fk_relationship_72 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table subject_course_retest add constraint fk_relationship_201 foreign key (serial_prd, serial_sbc)
      references subject_course_period (serial_prd, serial_sbc) on delete restrict on update restrict;

alter table subject_course_retest_student add constraint fk_relationship_202 foreign key (serial_scr)
      references subject_course_retest (serial_scr) on delete restrict on update restrict;

alter table subject_course_retest_student add constraint fk_relationship_203 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table subject_level_restriction add constraint fk_relationship_266 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table subject_level_restriction add constraint fk_relationship_267 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table subject_level_restriction add constraint fk_relationship_268 foreign key (serial_hbg)
      references hour_by_group (serial_hbg) on delete restrict on update restrict;

alter table subject_ministry_equivalence add constraint fk_relationship_166 foreign key (serial_msb)
      references ministry_subject (serial_msb) on delete restrict on update restrict;

alter table subject_ministry_equivalence add constraint fk_relationship_169 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table subject_ministry_equivalence add constraint fk_relationship_193 foreign key (serial_csb)
      references cat_subject (serial_csb) on delete restrict on update restrict;

alter table subject_ministry_equivalence 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) on delete restrict on update restrict;

alter table subject_ministry_equivalence add constraint fk_relationship_247 foreign key (serial_lop)
      references level_optional_group (serial_lop) on delete restrict on update restrict;

alter table subject_period_activity_type add constraint fk_relationship_84 foreign key (serial_prd, serial_sbc)
      references subject_course_period (serial_prd, serial_sbc) on delete restrict on update restrict;

alter table subject_period_activity_type add constraint fk_relationship_85 foreign key (serial_att)
      references activity_type (serial_att) on delete restrict on update restrict;

alter table subject_period_exam add constraint fk_relationship_305 foreign key (serial_ype)
      references year_period_exam_setup (serial_ype) on delete restrict on update restrict;

alter table subject_period_exam add constraint fk_relationship_306 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table subject_period_exam add constraint fk_relationship_307 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table subject_retest_change_log add constraint fk_relationship_212 foreign key (serial_std, serial_scr)
      references subject_course_retest_student (serial_std, serial_scr) on delete restrict on update restrict;

alter table subject_retest_change_log add constraint fk_relationship_213 foreign key (serial_chr)
      references change_reason (serial_chr) on delete restrict on update restrict;

alter table subject_retest_change_log add constraint fk_relationship_214 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table subject_year_activity_criteria_period add constraint fk_relationship_86 foreign key (serial_att, serial_prd, serial_sbc)
      references subject_period_activity_type (serial_att, serial_prd, serial_sbc) on delete restrict on update restrict;

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) on delete restrict on update restrict;

alter table subject_year_grade_criteria add constraint fk_relationship_82 foreign key (serial_sbj)
      references subject (serial_sbj) on delete restrict on update restrict;

alter table subject_year_grade_criteria add constraint fk_relationship_83 foreign key (serial_gct)
      references grade_criteria (serial_gct) on delete restrict on update restrict;

alter table subperiod add constraint fk_relationship_302 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table syllabus_files add constraint fk_relationship_128 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table syllabus_files add constraint fk_relationship_129 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table syllabus_files_change_log add constraint fk_relationship_132 foreign key (serial_syf)
      references syllabus_files (serial_syf) on delete restrict on update restrict;

alter table syllabus_files_change_log add constraint fk_relationship_133 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table teacher_hours_year add constraint fk_relationship_69 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table teacher_hours_year add constraint fk_relationship_70 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table user add constraint fk_employee_user2 foreign key (serial_emp)
      references employee (serial_emp) on delete restrict on update restrict;

alter table user add constraint fk_guardian_user2 foreign key (serial_grd)
      references guardian (serial_grd) on delete restrict on update restrict;

alter table user add constraint fk_relationship_339 foreign key (use_serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table user add constraint fk_student_user2 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table user_course_comment_setup add constraint fk_relationship_313 foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table user_course_comment_setup add constraint fk_relationship_314 foreign key (serial_crs)
      references course (serial_crs) on delete restrict on update restrict;

alter table user_profile add constraint fk_for_user foreign key (serial_prf)
      references profile (serial_prf) on delete restrict on update restrict;

alter table user_profile add constraint fk_has_profile foreign key (serial_usr)
      references user (serial_usr) on delete restrict on update restrict;

alter table visits_medical_center add constraint fk_relationship_197 foreign key (serial_mdf)
      references medical_file (serial_mdf) on delete restrict on update restrict;

alter table web_pre_registration add constraint fk_relationship_205 foreign key (serial_dgr)
      references degree (serial_dgr) on delete restrict on update restrict;

alter table web_pre_registration add constraint fk_relationship_206 foreign key (serial_nnt)
      references nationality (serial_nnt) on delete restrict on update restrict;

alter table web_pre_registration 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) on delete restrict on update restrict;

alter table web_pre_registration add constraint fk_relationship_208 foreign key (serial_wus)
      references web_user (serial_wus) on delete restrict on update restrict;

alter table web_pre_registration add constraint fk_relationship_242 foreign key (serial_ste)
      references state (serial_ste) on delete restrict on update restrict;

alter table year_concept_taxes add constraint fk_relationship_93 foreign key (serial_tax)
      references taxes (serial_tax) on delete restrict on update restrict;

alter table year_concept_taxes add constraint fk_relationship_94 foreign key (serial_ypc)
      references year_level_specialty_payment_concept (serial_ypc) on delete restrict on update restrict;

alter table year_discount add constraint fk_relationship_224 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table year_discount add constraint fk_relationship_225 foreign key (serial_dsc)
      references discount (serial_dsc) on delete restrict on update restrict;

alter table year_grade_subject add constraint fk_relationship_174 foreign key (serial_csb)
      references cat_subject (serial_csb) on delete restrict on update restrict;

alter table year_grade_subject add constraint fk_relationship_175 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table year_level_specialty_payment_concept 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) on delete restrict on update restrict;

alter table year_level_specialty_payment_concept add constraint fk_relationship_91 foreign key (serial_pct)
      references payment_concept (serial_pct) on delete restrict on update restrict;

alter table year_level_specialty_payment_concept add constraint fk_relationship_92 foreign key (serial_art)
      references article (serial_art) on delete restrict on update restrict;

alter table year_period_exam_setup add constraint fk_relationship_303 foreign key (serial_lvl, serial_scy, serial_set)
      references level_section_year (serial_lvl, serial_scy, serial_set) on delete restrict on update restrict;

alter table year_period_exam_setup add constraint fk_relationship_304 foreign key (serial_prd)
      references period (serial_prd) on delete restrict on update restrict;

alter table year_pre_registration_document add constraint fk_relationship_261 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table year_pre_registration_document add constraint fk_relationship_262 foreign key (serial_qdc)
      references qualifying_document (serial_qdc) on delete restrict on update restrict;

alter table year_qualifying_document add constraint fk_relationship_157 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table year_qualifying_document add constraint fk_relationship_158 foreign key (serial_qdc)
      references qualifying_document (serial_qdc) on delete restrict on update restrict;

alter table year_report_comment add constraint fk_relationship_259 foreign key (serial_std)
      references student (serial_std) on delete restrict on update restrict;

alter table year_report_comment add constraint fk_relationship_260 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table year_resit_exam_ranges add constraint fk_relationship_162 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table year_special_grade add constraint fk_relationship_178 foreign key (serial_scy)
      references school_year (serial_scy) on delete restrict on update restrict;

alter table year_subject_classroom add constraint fk_relationship_163 foreign key (serial_clr)
      references classroom (serial_clr) on delete restrict on update restrict;

alter table year_subject_classroom add constraint fk_relationship_164 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table year_subject_classroom add constraint fk_relationship_165 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;

alter table year_subject_skills add constraint fk_relationship_320 foreign key (serial_skl)
      references skills (serial_skl) on delete restrict on update restrict;

alter table year_subject_skills add constraint fk_relationship_321 foreign key (serial_sbc)
      references subject_course (serial_sbc) on delete restrict on update restrict;

alter table year_subject_skills add constraint fk_relationship_322 foreign key (serial_osb)
      references optional_subject (serial_osb) on delete restrict on update restrict;