-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdump.sql
More file actions
1034 lines (680 loc) · 23.7 KB
/
dump.sql
File metadata and controls
1034 lines (680 loc) · 23.7 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- PostgreSQL database dump
--
-- Dumped from database version 10.3 (Debian 10.3-1.pgdg90+1)
-- Dumped by pg_dump version 10.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: DATABASE postgres; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON DATABASE postgres IS 'default administrative connection database';
--
-- Name: back2school; Type: SCHEMA; Schema: -; Owner: postgres
--
CREATE SCHEMA back2school;
ALTER SCHEMA back2school OWNER TO postgres;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: receiver; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE public.receiver AS ENUM (
'student',
'parent',
'teacher',
'general'
);
ALTER TYPE public.receiver OWNER TO postgres;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: accounts; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.accounts (
username text NOT NULL,
password text NOT NULL,
kind text NOT NULL,
id integer NOT NULL
);
ALTER TABLE back2school.accounts OWNER TO postgres;
--
-- Name: admins; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.admins (
id integer NOT NULL,
info text DEFAULT ' '::text,
name text DEFAULT ' '::text,
surname text DEFAULT ' '::text
);
ALTER TABLE back2school.admins OWNER TO postgres;
--
-- Name: admins_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.admins_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.admins_id_seq OWNER TO postgres;
--
-- Name: admins_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.admins_id_seq OWNED BY back2school.admins.id;
--
-- Name: appointments; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.appointments (
student integer NOT NULL,
teacher integer NOT NULL,
location text DEFAULT ''::text,
"time" timestamp without time zone NOT NULL,
id integer NOT NULL
);
ALTER TABLE back2school.appointments OWNER TO postgres;
--
-- Name: appointments_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.appointments_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.appointments_id_seq OWNER TO postgres;
--
-- Name: appointments_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.appointments_id_seq OWNED BY back2school.appointments.id;
--
-- Name: classes; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.classes (
id integer NOT NULL,
year integer,
section text DEFAULT ' '::text,
info text,
grade integer
);
ALTER TABLE back2school.classes OWNER TO postgres;
--
-- Name: classes_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.classes_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.classes_id_seq OWNER TO postgres;
--
-- Name: classes_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.classes_id_seq OWNED BY back2school.classes.id;
--
-- Name: enrolled; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.enrolled (
student integer NOT NULL,
class integer NOT NULL
);
ALTER TABLE back2school.enrolled OWNER TO postgres;
--
-- Name: grades; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.grades (
student integer,
grade integer,
subject text DEFAULT ''::text,
date timestamp without time zone NOT NULL,
teacher integer NOT NULL,
id integer NOT NULL
);
ALTER TABLE back2school.grades OWNER TO postgres;
--
-- Name: grades_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.grades_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.grades_id_seq OWNER TO postgres;
--
-- Name: grades_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.grades_id_seq OWNED BY back2school.grades.id;
--
-- Name: isparent; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.isparent (
parent integer NOT NULL,
student integer NOT NULL
);
ALTER TABLE back2school.isparent OWNER TO postgres;
--
-- Name: notification; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.notification (
id integer NOT NULL,
receiver integer,
message text DEFAULT ''::text,
"time" time without time zone,
receiver_kind public.receiver DEFAULT 'general'::public.receiver NOT NULL
);
ALTER TABLE back2school.notification OWNER TO postgres;
--
-- Name: notification_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.notification_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.notification_id_seq OWNER TO postgres;
--
-- Name: notification_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.notification_id_seq OWNED BY back2school.notification.id;
--
-- Name: parents; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.parents (
id integer NOT NULL,
name text DEFAULT ''::text,
surname text DEFAULT ''::text,
mail text DEFAULT ''::text,
info text DEFAULT ''::text
);
ALTER TABLE back2school.parents OWNER TO postgres;
--
-- Name: parents_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.parents_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.parents_id_seq OWNER TO postgres;
--
-- Name: parents_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.parents_id_seq OWNED BY back2school.parents.id;
--
-- Name: payments; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.payments (
id integer NOT NULL,
amount integer,
student integer,
paid boolean DEFAULT false,
reason text DEFAULT ''::text,
emitted timestamp without time zone DEFAULT now()
);
ALTER TABLE back2school.payments OWNER TO postgres;
--
-- Name: payments_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.payments_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.payments_id_seq OWNER TO postgres;
--
-- Name: payments_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.payments_id_seq OWNED BY back2school.payments.id;
--
-- Name: students; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.students (
id integer NOT NULL,
name text DEFAULT ''::text,
surname text DEFAULT ''::text,
mail text DEFAULT ''::text,
info text DEFAULT ''::text
);
ALTER TABLE back2school.students OWNER TO postgres;
--
-- Name: students_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.students_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.students_id_seq OWNER TO postgres;
--
-- Name: students_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.students_id_seq OWNED BY back2school.students.id;
--
-- Name: subjects; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.subjects (
id text DEFAULT ''::text NOT NULL
);
ALTER TABLE back2school.subjects OWNER TO postgres;
--
-- Name: teachers; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.teachers (
id integer NOT NULL,
name text DEFAULT ''::text,
mail text DEFAULT ''::text,
info text DEFAULT ''::text,
surname text DEFAULT ''::text
);
ALTER TABLE back2school.teachers OWNER TO postgres;
--
-- Name: teachers_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.teachers_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.teachers_id_seq OWNER TO postgres;
--
-- Name: teachers_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.teachers_id_seq OWNED BY back2school.teachers.id;
--
-- Name: teaches; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.teaches (
teacher integer NOT NULL,
subject text DEFAULT ''::text NOT NULL,
class integer NOT NULL
);
ALTER TABLE back2school.teaches OWNER TO postgres;
--
-- Name: timetable; Type: TABLE; Schema: back2school; Owner: postgres
--
CREATE TABLE back2school.timetable (
class integer NOT NULL,
subject text DEFAULT ''::text NOT NULL,
location text DEFAULT ''::text,
start time without time zone,
"end" time without time zone,
info text DEFAULT ''::text,
id integer NOT NULL
);
ALTER TABLE back2school.timetable OWNER TO postgres;
--
-- Name: timetable_id_seq; Type: SEQUENCE; Schema: back2school; Owner: postgres
--
CREATE SEQUENCE back2school.timetable_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE back2school.timetable_id_seq OWNER TO postgres;
--
-- Name: timetable_id_seq; Type: SEQUENCE OWNED BY; Schema: back2school; Owner: postgres
--
ALTER SEQUENCE back2school.timetable_id_seq OWNED BY back2school.timetable.id;
--
-- Name: admins id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.admins ALTER COLUMN id SET DEFAULT nextval('back2school.admins_id_seq'::regclass);
--
-- Name: appointments id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.appointments ALTER COLUMN id SET DEFAULT nextval('back2school.appointments_id_seq'::regclass);
--
-- Name: classes id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.classes ALTER COLUMN id SET DEFAULT nextval('back2school.classes_id_seq'::regclass);
--
-- Name: grades id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.grades ALTER COLUMN id SET DEFAULT nextval('back2school.grades_id_seq'::regclass);
--
-- Name: notification id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.notification ALTER COLUMN id SET DEFAULT nextval('back2school.notification_id_seq'::regclass);
--
-- Name: parents id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.parents ALTER COLUMN id SET DEFAULT nextval('back2school.parents_id_seq'::regclass);
--
-- Name: payments id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.payments ALTER COLUMN id SET DEFAULT nextval('back2school.payments_id_seq'::regclass);
--
-- Name: students id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.students ALTER COLUMN id SET DEFAULT nextval('back2school.students_id_seq'::regclass);
--
-- Name: teachers id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.teachers ALTER COLUMN id SET DEFAULT nextval('back2school.teachers_id_seq'::regclass);
--
-- Name: timetable id; Type: DEFAULT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.timetable ALTER COLUMN id SET DEFAULT nextval('back2school.timetable_id_seq'::regclass);
--
-- Data for Name: accounts; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.accounts (username, password, kind, id) FROM stdin;
a $2a$04$3gNENZCutU4.6JtklLNB7OmEvxn5Tr6KSSo8zXKbqojifwlJscEF6 Admin 2
pippo $2a$04$3gNENZCutU4.6JtklLNB7OmEvxn5Tr6KSSo8zXKbqojifwlJscEF6 Parent 3
admin $2a$04$3gNENZCutU4.6JtklLNB7OmEvxn5Tr6KSSo8zXKbqojifwlJscEF6 Admin 1
philippe $2a$10$kulRkFpy6hE.Z9i3uxbQN.6PUw4qpMGMmAd7d7I1fX2tDVm1O3Hu. Admin 3
\.
--
-- Data for Name: admins; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.admins (id, info, name, surname) FROM stdin;
\.
--
-- Data for Name: appointments; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.appointments (student, teacher, location, "time", id) FROM stdin;
1 1 \N 2018-05-06 12:17:24.289 2
\.
--
-- Data for Name: classes; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.classes (id, year, section, info, grade) FROM stdin;
2 1994 a 1 5
3 1999 a 1 4
\.
--
-- Data for Name: enrolled; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.enrolled (student, class) FROM stdin;
1 2
\.
--
-- Data for Name: grades; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.grades (student, grade, subject, date, teacher, id) FROM stdin;
1 10 science 2019-05-06 11:17:55.784 1 1
\.
--
-- Data for Name: isparent; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.isparent (parent, student) FROM stdin;
3 1
\.
--
-- Data for Name: notification; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.notification (id, receiver, message, "time", receiver_kind) FROM stdin;
1 1 prova \N student
2 \N prova \N general
\.
--
-- Data for Name: parents; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.parents (id, name, surname, mail, info) FROM stdin;
4 pi pi \N \N
3 pippa pippo
\.
--
-- Data for Name: payments; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.payments (id, amount, student, paid, reason, emitted) FROM stdin;
1 100 1 f 2018-05-06 17:07:46.55
2 100 2 t 2018-05-06 17:07:48.518
3 \N \N f \N 2018-05-06 17:09:32.253582
\.
--
-- Data for Name: students; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.students (id, name, surname, mail, info) FROM stdin;
1 philippe scorsolini mail@mail.com \N
2 lorenzo petrangeli mail@mail.it \N
\.
--
-- Data for Name: subjects; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.subjects (id) FROM stdin;
science
\.
--
-- Data for Name: teachers; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.teachers (id, name, mail, info, surname) FROM stdin;
1 mantesso mail mail
\.
--
-- Data for Name: teaches; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.teaches (teacher, subject, class) FROM stdin;
1 science 2
1 science 3
\.
--
-- Data for Name: timetable; Type: TABLE DATA; Schema: back2school; Owner: postgres
--
COPY back2school.timetable (class, subject, location, start, "end", info, id) FROM stdin;
2 science \N \N 2
\.
--
-- Name: admins_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.admins_id_seq', 1, false);
--
-- Name: appointments_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.appointments_id_seq', 1, false);
--
-- Name: classes_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.classes_id_seq', 1, false);
--
-- Name: grades_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.grades_id_seq', 1, true);
--
-- Name: notification_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.notification_id_seq', 1, false);
--
-- Name: parents_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.parents_id_seq', 1, false);
--
-- Name: payments_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.payments_id_seq', 1, false);
--
-- Name: students_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.students_id_seq', 1, false);
--
-- Name: teachers_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.teachers_id_seq', 1, false);
--
-- Name: timetable_id_seq; Type: SEQUENCE SET; Schema: back2school; Owner: postgres
--
SELECT pg_catalog.setval('back2school.timetable_id_seq', 2, true);
--
-- Name: accounts accounts_kind_id_pk; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.accounts
ADD CONSTRAINT accounts_kind_id_pk UNIQUE (kind, id);
--
-- Name: accounts accounts_user_pk; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.accounts
ADD CONSTRAINT accounts_user_pk PRIMARY KEY (username);
--
-- Name: admins admins_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.admins
ADD CONSTRAINT admins_pkey PRIMARY KEY (id);
--
-- Name: appointments appointments_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.appointments
ADD CONSTRAINT appointments_pkey PRIMARY KEY (id);
--
-- Name: classes classes_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.classes
ADD CONSTRAINT classes_pkey PRIMARY KEY (id);
--
-- Name: enrolled enrolled_student_class_pk; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.enrolled
ADD CONSTRAINT enrolled_student_class_pk PRIMARY KEY (student, class);
--
-- Name: grades grades_id_pk; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.grades
ADD CONSTRAINT grades_id_pk PRIMARY KEY (id);
--
-- Name: isparent isparent_parent_student_pk; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.isparent
ADD CONSTRAINT isparent_parent_student_pk PRIMARY KEY (parent, student);
--
-- Name: notification notification_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.notification
ADD CONSTRAINT notification_pkey PRIMARY KEY (id);
--
-- Name: parents parents_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.parents
ADD CONSTRAINT parents_pkey PRIMARY KEY (id);
--
-- Name: payments payments_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.payments
ADD CONSTRAINT payments_pkey PRIMARY KEY (id);
--
-- Name: students students_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.students
ADD CONSTRAINT students_pkey PRIMARY KEY (id);
--
-- Name: subjects subjects_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.subjects
ADD CONSTRAINT subjects_pkey PRIMARY KEY (id);
--
-- Name: teachers teachers_pkey; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.teachers
ADD CONSTRAINT teachers_pkey PRIMARY KEY (id);
--
-- Name: teaches teaches_teacher_subject_class_pk; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.teaches
ADD CONSTRAINT teaches_teacher_subject_class_pk PRIMARY KEY (teacher, subject, class);
--
-- Name: timetable timetable_id_pk; Type: CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.timetable
ADD CONSTRAINT timetable_id_pk PRIMARY KEY (id);
--
-- Name: accounts_user_uindex; Type: INDEX; Schema: back2school; Owner: postgres
--
CREATE UNIQUE INDEX accounts_user_uindex ON back2school.accounts USING btree (username);
--
-- Name: grades_student_subject_date_pk; Type: INDEX; Schema: back2school; Owner: postgres
--
CREATE UNIQUE INDEX grades_student_subject_date_pk ON back2school.grades USING btree (student, subject, date);
--
-- Name: appointments appointments_student_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.appointments
ADD CONSTRAINT appointments_student_id_fk FOREIGN KEY (student) REFERENCES back2school.students(id);
--
-- Name: appointments appointments_teacher_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.appointments
ADD CONSTRAINT appointments_teacher_id_fk FOREIGN KEY (teacher) REFERENCES back2school.teachers(id);
--
-- Name: enrolled enrolled_classes_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.enrolled
ADD CONSTRAINT enrolled_classes_id_fk FOREIGN KEY (class) REFERENCES back2school.classes(id);
--
-- Name: enrolled enrolled_students_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.enrolled
ADD CONSTRAINT enrolled_students_id_fk FOREIGN KEY (student) REFERENCES back2school.students(id);
--
-- Name: grades grades_students_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.grades
ADD CONSTRAINT grades_students_id_fk FOREIGN KEY (student) REFERENCES back2school.students(id);
--
-- Name: grades grades_teachers_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.grades
ADD CONSTRAINT grades_teachers_id_fk FOREIGN KEY (teacher) REFERENCES back2school.teachers(id);
--
-- Name: isparent isparent_parents_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.isparent
ADD CONSTRAINT isparent_parents_id_fk FOREIGN KEY (parent) REFERENCES back2school.parents(id);
--
-- Name: isparent isparent_students_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.isparent
ADD CONSTRAINT isparent_students_id_fk FOREIGN KEY (student) REFERENCES back2school.students(id);
--
-- Name: payments payments_students_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.payments
ADD CONSTRAINT payments_students_id_fk FOREIGN KEY (student) REFERENCES back2school.students(id);
--
-- Name: teaches teaches_classes_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres
--
ALTER TABLE ONLY back2school.teaches
ADD CONSTRAINT teaches_classes_id_fk FOREIGN KEY (class) REFERENCES back2school.classes(id);
--
-- Name: teaches teaches_subjects_id_fk; Type: FK CONSTRAINT; Schema: back2school; Owner: postgres