Table Students { id integer [pk, increment, not null, unique, note: 'Номер студенческого билета'] person_id integer [not null, unique, note: 'Номер физического лица'] group varchar [not null, note: 'Номер учебной группы'] supervisor integer [note: 'Номер научного руководителя'] education_form varchar [not null, default: 'Очная', note: 'Форма обучения студента'] status varchar [not null, default: 'Учится', note: 'Статус обучающегося'] } Table Persons { id integer [pk, increment, not null, unique] name varchar [not null] surname varchar [not null] birthday timestamp [not null] phone varchar [not null] mail varchar [default: null] passport_no varchar [not null] citizenship varchar [not null] address varchar [not null] access_card varchar [not null] access_level varchar [not null] } Table Groups { group varchar [pk, not null, unique] faculty_id integer [not null] program_id integer [not null] department_id integer [not null] study_starts timestamp [not null] study_ends timestamp [not null] } Table Family { id integer [pk, increment, not null, unique] student_id integer [not null] name varchar [not null] surname varchar [not null] kinship varchar [not null, note: 'Степень родства: mthr, fthr, brth, sstr'] phone varchar [not null] address varchar [not null] } Table Files { id integer [pk, increment, not null, unique] student_id integer [not null] name varchar [not null] description varchar [not null] extension varchar [not null, note: 'available: png, jpeg, pdf'] size numeric [not null, note: 'size in mb'] path varchar [not null, note: 'path to file /var/www/student_files/.'] loaded_at timestamp [not null] } Table Supervisors { id integer [pk, increment, not null, unique] person_id integer [not null] experience integer [not null] defended_ratio real [not null] qualification varchar [not null] } Table Movement { id integer [pk, increment, not null, unique] student_id integer [not null] type varchar [not null] new_group varchar new_status varchar issued_at timestamp [not null] } Table Departments { id integer [pk, increment, not null, unique] name varchar [not null] acronym varchar [not null] founded timestamp [not null] head integer [not null] vice integer secretary integer faculty_id integer } Table Programs { id integer [pk, increment, not null, unique] specification varchar [not null, note: 'Key from Russian register'] degree varchar [not null] name varchar [not null] parent_id integer [not null] } Table Faculties { id integer [pk, increment, not null, unique] name varchar [not null] acronym varchar [not null] head integer [not null] vice integer address varchar [not null] } Table Statements { id integer [pk, increment, not null, unique] student_id integer [not null] discipline_id integer [not null] examiner_id integer [not null] try_no integer [not null] grade integer [not null] conducted_at timestamp [not null] } Table Disciplines { id integer [pk, increment, not null, unique] name varchar [not null] department_id integer [not null] credit_units integer [not null] academic_hours integer [not null] general_hours integer [not null] is_annual boolean [not null] } Ref "Студент к физлицу" { Persons.id - Students.person_id [delete: no action] } Ref "Загружен для" { Files.student_id > Students.id [delete: no action] } Ref "Руководитель к физлицу" { Departments.head - Persons.id [delete: no action] } Ref "Заместитель к физлицу" { Departments.vice - Persons.id [delete: no action] } Ref "Секретарь к физлицу" { Departments.secretary - Persons.id [delete: no action] } Ref "К научному руководителю" { Students.supervisor > Supervisors.id [delete: no action] } Ref "В учебной группе" { Students.group > Groups.group [delete: no action] } Ref "План/программа группы" { Groups.program_id > Programs.id [delete: no action] } Ref "Группа факультета" { Groups.faculty_id > Faculties.id [delete: no action] } Ref "Имеет базовую кафедру" { Groups.department_id > Departments.id [delete: no action] } Ref "Ведомость по студенту" { Statements.student_id > Students.id [delete: no action] } Ref "Ведомость по дисциплине" { Statements.discipline_id > Disciplines.id [delete: no action] } Ref "Экзаменатор к физлицу" { Statements.examiner_id > Persons.id [delete: no action] } Ref "Дисциплина к кафедре" { Disciplines.department_id > Departments.id [delete: no action] } Ref "Подразделение факультета" { Departments.faculty_id > Faculties.id [delete: no action] } Ref "Приказ по студенту" { Movement.student_id > Students.id [delete: no action] } Ref "Научный руководитель к физлицу" { Supervisors.person_id - Persons.id [delete: no action] } Ref "Дочерний к программе" { Programs.parent_id - Programs.id [delete: no action] } Ref "Родственник студента" { Family.student_id > Students.id [delete: no action] }