Browse Source

add db design&release

Alexandra Schekaleva 6 months ago
parent
commit
bc46029ce8
2 changed files with 111 additions and 0 deletions
  1. 1 0
      ~$зработка_БД.docx
  2. 110 0
      разработка_БД.docx

+ 1 - 0
~$зработка_БД.docx

@@ -0,0 +1 @@
+	Alexandra	AlexandraH‰§Ú_¡6æ¾é*RÑƉ§Ú3Ëø

+ 110 - 0
разработка_БД.docx

@@ -0,0 +1,110 @@
+--роли
+create table Roles
+(
+	Id SERIAL primary key,
+	name character varying(30) unique
+);
+--пользователи
+create table Users
+(
+	Id Serial primary key,
+	first_name character varying(30) not null,
+	last_name character varying(30) not null,
+	middle_name character varying(30),
+	mail character varying(50) not null unique,
+	phone_number character varying(20) unique,
+	date_birth date,
+	Id_role int references Roles(Id) not null
+);
+--Кафедры
+create table Departments
+(
+	Id SERIAL primary key,
+	name character varying(70) unique not null
+);
+--Специальности
+create table Specialties
+(
+	Id SERIAL primary key,
+	name character varying(70) unique not null,
+	Id_department int references Departments(Id) not null
+);
+--Группы
+create table "Groups"
+(
+	Id Serial primary key,
+	Id_specialty int references Specialties(Id) not null,
+	start_date date not null,
+	name character varying(5) not null
+);
+--студенты
+create table Students
+(
+	user_Id int references Users(Id) primary key,
+	group_Id int references "Groups"(Id) not null
+);
+--корпусы (филиалы)
+create table Buildings
+(
+	Id serial primary key,
+	Mgr int references Users(Id) not null,--заведующий
+	address character varying(70) not null
+);
+--преподаватели
+create table Teachers
+(
+	user_Id int references Users(Id) primary key,
+	department_Id int references Departments(Id)
+);
+--дисциплины
+create table Disciplines
+(
+	Id serial primary key,
+	name character varying(60) not null,
+	department_Id int references Departments(Id) not null,
+	academic_hours int not null
+);
+--дисциплины преподавателей
+create table TeachersDisciplines
+(
+	Id serial primary key,
+	teacher_Id int references Teachers(user_Id) not null,
+	discipline_Id int references Disciplines(Id) not null
+);
+--дисциплины групп
+create table GroupDiscipline
+(
+	Id serial primary key,
+	semester int,
+	teacher_discipline_Id int references TeachersDisciplines(Id) not null,
+	group_Id int references "Groups"(Id) not null
+);
+--расписание
+create table Timetables
+(
+	Id serial primary key,
+	class_date date not null,
+	class_number smallint,
+	group_discipline_Id int references GroupDiscipline(Id) not null,
+   buildind_Id int references Buildings(Id) not null
+);
+--оценки
+create table StudentGrades
+(
+	Id Serial primary key,
+	student_Id int references Students(user_Id) not null,
+	group_discipline_Id int references GroupDiscipline(Id) not null,
+	graded_at date,
+	grade smallint not null,
+	work_name character varying(70)
+);
+--посещаемость
+create table Attendance
+(
+	Id serial primary key,
+	timetable_Id int references Timetables(Id) not null,
+	student_Id int references Students(user_Id) not null,
+	attended bool not null
+);
+
+