-
Notifications
You must be signed in to change notification settings - Fork 1
/
ddl.txt
153 lines (133 loc) · 3.69 KB
/
ddl.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
create table migrations
(
id serial
constraint migrations_pkey
primary key,
migration varchar(255) not null,
batch integer not null
);
alter table migrations
owner to "default";
create table skills
(
id bigserial
constraint skills_pkey
primary key,
title varchar(255) not null,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table skills
owner to "default";
create table courses
(
id bigserial
constraint courses_pkey
primary key,
title varchar(255) not null,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table courses
owner to "default";
create table modules
(
id bigserial
constraint modules_pkey
primary key,
title varchar(255) not null,
course_id bigint not null
constraint modules_course_id_foreign
references courses,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table modules
owner to "default";
create table tasks
(
id bigserial
constraint tasks_pkey
primary key,
title varchar(255) not null,
module_id bigint not null
constraint tasks_module_id_foreign
references modules,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table tasks
owner to "default";
create table students
(
id bigserial
constraint students_pkey
primary key,
first_name varchar(255) not null,
last_name varchar(255) not null,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table students
owner to "default";
create table tasks_skills
(
id bigserial
constraint tasks_skills_pkey
primary key,
task_id bigint not null
constraint tasks_skills_task_id_foreign
references tasks,
skill_id bigint not null
constraint tasks_skills_skill_id_foreign
references skills,
percent integer not null,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table tasks_skills
owner to "default";
create table students_tasks_skills_raitings
(
id bigint default nextval('students_tasks_skills_raitings_id_seq'::regclass) not null
constraint students_tasks_skills_raitings_pkey
primary key,
student_id bigint not null
constraint students_tasks_skills_raitings_student_id_foreign
references students,
skill_id bigint not null
constraint students_tasks_skills_raitings_skill_id_foreign
references skills,
raiting integer not null,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table students_tasks_skills_raitings
owner to "default";
create table awards
(
id bigserial
constraint awards_pkey
primary key,
title varchar(255) not null,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table awards
owner to "default";
create table students_awards
(
id bigserial
constraint students_awards_pkey
primary key,
student_id bigint not null
constraint students_awards_student_id_foreign
references students,
award_id bigint not null
constraint students_awards_award_id_foreign
references awards,
created_at timestamp(0),
updated_at timestamp(0)
);
alter table students_awards
owner to "default";