forked from adriansangil/hris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hris_bak.sql
1113 lines (897 loc) · 40.5 KB
/
hris_bak.sql
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
CREATE TABLE academic_year (
academic_year_id integer NOT NULL,
start_date date,
end_date date,
active boolean DEFAULT true,
start_year integer,
end_year integer
);
ALTER TABLE public.academic_year OWNER TO postgres;
CREATE TABLE base_benefit (
base_benefit_id integer NOT NULL,
max_benefit real,
min_months integer,
max_months integer,
employee_type_id integer,
employee_status character varying,
active boolean DEFAULT true,
max_convertible real
);
ALTER TABLE public.base_benefit OWNER TO postgres;
CREATE SEQUENCE base_benefit_base_benefit_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.base_benefit_base_benefit_id_seq OWNER TO postgres;
ALTER SEQUENCE base_benefit_base_benefit_id_seq OWNED BY base_benefit.base_benefit_id;
CREATE TABLE base_leave (
base_leave_id integer NOT NULL,
max_leave integer,
max_convertible integer,
min_months integer,
max_months integer,
leave_type_id integer,
employee_type_id integer,
employee_status character varying,
active boolean DEFAULT true
);
ALTER TABLE public.base_leave OWNER TO postgres;
CREATE SEQUENCE base_leave_base_leave_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.base_leave_base_leave_id_seq OWNER TO postgres;
ALTER SEQUENCE base_leave_base_leave_id_seq OWNED BY base_leave.base_leave_id;
CREATE TABLE base_points (
base_points_id integer NOT NULL,
criteria_id integer,
employee_type_id integer,
base_description character varying,
base_points integer
);
ALTER TABLE public.base_points OWNER TO postgres;
CREATE SEQUENCE base_points_base_points_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.base_points_base_points_id_seq OWNER TO postgres;
ALTER SEQUENCE base_points_base_points_id_seq OWNED BY base_points.base_points_id;
CREATE TABLE certification_board (
certification_board_id integer NOT NULL,
employee_type_id integer,
certification_board_type_id integer,
certification_board_detail_id integer,
cert_points integer
);
ALTER TABLE public.certification_board OWNER TO postgres;
CREATE TABLE certification_board_acquired (
certification_board_acquired_id integer NOT NULL,
certification_board_id integer,
cert_board_description character varying,
cert_date date,
employee_id integer
);
ALTER TABLE public.certification_board_acquired OWNER TO postgres;
CREATE SEQUENCE certification_board_acquired_certification_board_acquired_i_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.certification_board_acquired_certification_board_acquired_i_seq OWNER TO postgres;
ALTER SEQUENCE certification_board_acquired_certification_board_acquired_i_seq OWNED BY certification_board_acquired.certification_board_acquired_id;
CREATE SEQUENCE certification_board_certification_board_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.certification_board_certification_board_id_seq OWNER TO postgres;
ALTER SEQUENCE certification_board_certification_board_id_seq OWNED BY certification_board.certification_board_id;
CREATE TABLE certification_board_detail (
certification_board_detail_id integer NOT NULL,
cert_detail character varying
);
ALTER TABLE public.certification_board_detail OWNER TO postgres;
CREATE SEQUENCE certification_board_detail_certification_board_detail_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.certification_board_detail_certification_board_detail_id_seq OWNER TO postgres;
ALTER SEQUENCE certification_board_detail_certification_board_detail_id_seq OWNED BY certification_board_detail.certification_board_detail_id;
CREATE TABLE certification_board_type (
certification_board_type_id integer NOT NULL,
cert_type character varying
);
ALTER TABLE public.certification_board_type OWNER TO postgres;
CREATE SEQUENCE certification_board_type_certification_board_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.certification_board_type_certification_board_type_id_seq OWNER TO postgres;
ALTER SEQUENCE certification_board_type_certification_board_type_id_seq OWNED BY certification_board_type.certification_board_type_id;
CREATE TABLE criteria (
criteria_id integer NOT NULL,
criteria_description character varying
);
ALTER TABLE public.criteria OWNER TO postgres;
CREATE SEQUENCE criteria_criteria_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.criteria_criteria_id_seq OWNER TO postgres;
ALTER SEQUENCE criteria_criteria_id_seq OWNED BY criteria.criteria_id;
CREATE TABLE education (
education_id integer NOT NULL,
educational_attainment_id integer,
course_description character varying,
school_description character(1),
employee_id integer
);
ALTER TABLE public.education OWNER TO postgres;
CREATE TABLE education_detail (
education_detail_id integer NOT NULL,
detail character varying
);
ALTER TABLE public.education_detail OWNER TO postgres;
CREATE SEQUENCE education_detail_id_education_detail_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.education_detail_id_education_detail_id_seq OWNER TO postgres;
ALTER SEQUENCE education_detail_id_education_detail_id_seq OWNED BY education_detail.education_detail_id;
CREATE SEQUENCE education_education_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.education_education_id_seq OWNER TO postgres;
ALTER SEQUENCE education_education_id_seq OWNED BY education.education_id;
CREATE TABLE education_level (
education_level_id integer NOT NULL,
level_description character varying
);
ALTER TABLE public.education_level OWNER TO postgres;
CREATE SEQUENCE education_level_education_level_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.education_level_education_level_id_seq OWNER TO postgres;
ALTER SEQUENCE education_level_education_level_id_seq OWNED BY education_level.education_level_id;
CREATE TABLE educational_attainment (
educational_attainment_id integer NOT NULL,
employee_type_id integer,
education_level_id integer,
education_detail_id integer,
educ_points integer
);
ALTER TABLE public.educational_attainment OWNER TO postgres;
CREATE SEQUENCE educational_attainment_educational_attainment_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.educational_attainment_educational_attainment_id_seq OWNER TO postgres;
ALTER SEQUENCE educational_attainment_educational_attainment_id_seq OWNED BY educational_attainment.educational_attainment_id;
CREATE TABLE employee_information (
employee_id integer NOT NULL,
first_name character varying(100),
middle_name character varying(100),
last_name character varying(100),
gender character varying(10),
address character varying(100),
mobile_num character varying(30),
work_email character varying(100),
username character varying(30),
password character varying(32),
active boolean DEFAULT true,
employee_type_id integer,
user_type_id integer,
display_picture text DEFAULT 'user-image.png'::text,
job_position_id integer,
managerial_exp integer,
birthdate date
);
ALTER TABLE public.employee_information OWNER TO postgres;
CREATE SEQUENCE employee_information_employee_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.employee_information_employee_id_seq OWNER TO postgres;
ALTER SEQUENCE employee_information_employee_id_seq OWNED BY employee_information.employee_id;
CREATE TABLE employee_medical_record (
employee_medical_record_id integer NOT NULL,
employee_id integer,
benefit_consumed real,
year_id integer,
base_benefit_id integer,
active boolean DEFAULT true,
employee_type_id integer,
status_id integer
);
ALTER TABLE public.employee_medical_record OWNER TO postgres;
CREATE SEQUENCE employee_medical_record_employee_medical_record_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.employee_medical_record_employee_medical_record_id_seq OWNER TO postgres;
ALTER SEQUENCE employee_medical_record_employee_medical_record_id_seq OWNED BY employee_medical_record.employee_medical_record_id;
CREATE TABLE employee_record (
employee_record_id integer NOT NULL,
employee_id integer,
vl real,
vl_lwop real,
sl real,
sl_lwop real,
others real,
active boolean DEFAULT true,
academic_year_id integer,
vl_base_id integer,
sl_base_id integer,
employee_type_id integer,
status_id integer
);
ALTER TABLE public.employee_record OWNER TO postgres;
CREATE SEQUENCE employee_record_employee_record_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.employee_record_employee_record_id_seq OWNER TO postgres;
ALTER SEQUENCE employee_record_employee_record_id_seq OWNED BY employee_record.employee_record_id;
CREATE TABLE employee_type (
employee_type_id integer NOT NULL,
employee_type character varying
);
ALTER TABLE public.employee_type OWNER TO postgres;
CREATE SEQUENCE employee_type_employee_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.employee_type_employee_type_id_seq OWNER TO postgres;
ALTER SEQUENCE employee_type_employee_type_id_seq OWNED BY employee_type.employee_type_id;
CREATE TABLE employee_type_history (
employee_type_history_id integer NOT NULL,
employee_id integer,
employee_type_id integer,
type_start_date date,
type_end_date date,
active boolean DEFAULT true
);
ALTER TABLE public.employee_type_history OWNER TO postgres;
CREATE SEQUENCE employee_type_history_employee_type_history_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.employee_type_history_employee_type_history_id_seq OWNER TO postgres;
ALTER SEQUENCE employee_type_history_employee_type_history_id_seq OWNED BY employee_type_history.employee_type_history_id;
CREATE TABLE faculty_rank (
faculty_rank_id integer NOT NULL,
faculty_rank_description character varying
);
ALTER TABLE public.faculty_rank OWNER TO postgres;
CREATE TABLE faculty_rank_classification (
faculty_rank_classification_id integer NOT NULL,
faculty_rank_id integer,
level_id integer,
min_point_range_f integer,
max_point_range_f integer,
education_requirement_id integer,
teaching_exp integer,
managerial_exp integer,
faculty_salary real
);
ALTER TABLE public.faculty_rank_classification OWNER TO postgres;
CREATE SEQUENCE faculty_rank_classification_faculty_rank_classification_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.faculty_rank_classification_faculty_rank_classification_id_seq OWNER TO postgres;
ALTER SEQUENCE faculty_rank_classification_faculty_rank_classification_id_seq OWNED BY faculty_rank_classification.faculty_rank_classification_id;
CREATE SEQUENCE faculty_rank_faculty_rank_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.faculty_rank_faculty_rank_id_seq OWNER TO postgres;
ALTER SEQUENCE faculty_rank_faculty_rank_id_seq OWNED BY faculty_rank.faculty_rank_id;
CREATE TABLE holiday (
holiday_id integer NOT NULL,
description character varying(100),
date date,
active boolean DEFAULT true,
holiday_type_id integer
);
ALTER TABLE public.holiday OWNER TO postgres;
CREATE SEQUENCE holiday_holiday_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.holiday_holiday_id_seq OWNER TO postgres;
ALTER SEQUENCE holiday_holiday_id_seq OWNED BY holiday.holiday_id;
CREATE TABLE holiday_type (
holiday_type_id integer NOT NULL,
description character varying,
active boolean DEFAULT true
);
ALTER TABLE public.holiday_type OWNER TO postgres;
CREATE SEQUENCE holiday_type_holiday_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.holiday_type_holiday_type_id_seq OWNER TO postgres;
ALTER SEQUENCE holiday_type_holiday_type_id_seq OWNED BY holiday_type.holiday_type_id;
CREATE TABLE job_position (
job_position_id integer NOT NULL,
"position" character varying,
staff_job_grade_id integer
);
ALTER TABLE public.job_position OWNER TO postgres;
CREATE TABLE leave (
leave_type_id integer NOT NULL,
leave_start_date date,
leave_end_date date,
date_submitted date,
date_decided date,
status character varying(10),
remarks character varying(200),
leave_id integer NOT NULL,
employee_id integer NOT NULL,
duration real,
base_leave_id integer,
academic_year_id integer
);
ALTER TABLE public.leave OWNER TO postgres;
CREATE SEQUENCE leave_employee_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.leave_employee_id_seq OWNER TO postgres;
ALTER SEQUENCE leave_employee_id_seq OWNED BY leave.employee_id;
CREATE SEQUENCE leave_leave_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.leave_leave_id_seq OWNER TO postgres;
ALTER SEQUENCE leave_leave_id_seq OWNED BY leave.leave_id;
CREATE SEQUENCE leave_leave_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.leave_leave_type_id_seq OWNER TO postgres;
ALTER SEQUENCE leave_leave_type_id_seq OWNED BY leave.leave_type_id;
CREATE TABLE leave_type (
leave_type_id integer NOT NULL,
type character varying,
active boolean DEFAULT true,
description character varying
);
ALTER TABLE public.leave_type OWNER TO postgres;
CREATE SEQUENCE leave_type_leave_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.leave_type_leave_type_id_seq OWNER TO postgres;
ALTER SEQUENCE leave_type_leave_type_id_seq OWNED BY leave_type.leave_type_id;
CREATE TABLE level (
level_id integer NOT NULL,
level character varying
);
ALTER TABLE public.level OWNER TO postgres;
CREATE SEQUENCE level_level_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.level_level_id_seq OWNER TO postgres;
ALTER SEQUENCE level_level_id_seq OWNED BY level.level_id;
CREATE TABLE medical (
medical_id integer NOT NULL,
amount real,
date_decided date,
status character varying,
employee_id integer,
remarks character varying,
base_benefit_id integer,
year_id integer,
date_submitted date
);
ALTER TABLE public.medical OWNER TO postgres;
CREATE SEQUENCE medical_medical_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.medical_medical_id_seq OWNER TO postgres;
ALTER SEQUENCE medical_medical_id_seq OWNED BY medical.medical_id;
CREATE TABLE medical_receipt (
medical_receipt_id integer NOT NULL,
receipt_date date,
receipt_number character varying,
receipt_amount real,
medical_id integer,
status character varying DEFAULT 'Pending'::character varying
);
ALTER TABLE public.medical_receipt OWNER TO postgres;
CREATE SEQUENCE medical_receipt_medical_receipt_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.medical_receipt_medical_receipt_id_seq OWNER TO postgres;
ALTER SEQUENCE medical_receipt_medical_receipt_id_seq OWNED BY medical_receipt.medical_receipt_id;
CREATE TABLE rank (
rank_id integer NOT NULL,
employee_id integer,
total_rank_points integer,
rank_position character varying,
rank_active boolean DEFAULT true,
rank_date_id integer,
rank_salary real,
educ_attain integer,
work_exp integer,
cert_passed integer,
educ_multiplier real,
work_multiplier real,
cert_multiplier real
);
ALTER TABLE public.rank OWNER TO postgres;
CREATE TABLE rank_date (
rank_date_id integer NOT NULL,
rank_date date,
active boolean DEFAULT true
);
ALTER TABLE public.rank_date OWNER TO postgres;
CREATE SEQUENCE rank_date_rank_date_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.rank_date_rank_date_id_seq OWNER TO postgres;
ALTER SEQUENCE rank_date_rank_date_id_seq OWNED BY rank_date.rank_date_id;
CREATE SEQUENCE rank_educ_attain_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.rank_educ_attain_seq OWNER TO postgres;
ALTER SEQUENCE rank_educ_attain_seq OWNED BY rank.educ_attain;
CREATE SEQUENCE rank_rank_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.rank_rank_id_seq OWNER TO postgres;
ALTER SEQUENCE rank_rank_id_seq OWNED BY rank.rank_id;
CREATE SEQUENCE school_year_school_year_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.school_year_school_year_id_seq OWNER TO postgres;
ALTER SEQUENCE school_year_school_year_id_seq OWNED BY academic_year.academic_year_id;
CREATE TABLE staff_job_grade (
staff_job_grade_id integer NOT NULL,
value integer,
grade character varying,
job_description character varying
);
ALTER TABLE public.staff_job_grade OWNER TO postgres;
CREATE SEQUENCE staff_job_grade_staff_job_grade_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.staff_job_grade_staff_job_grade_id_seq OWNER TO postgres;
ALTER SEQUENCE staff_job_grade_staff_job_grade_id_seq OWNED BY staff_job_grade.staff_job_grade_id;
CREATE SEQUENCE staff_position_staff_position_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.staff_position_staff_position_id_seq OWNER TO postgres;
ALTER SEQUENCE staff_position_staff_position_id_seq OWNED BY job_position.job_position_id;
CREATE TABLE staff_rank_classification (
staff_rank_classification_id integer NOT NULL,
staff_job_grade_id integer,
level_id integer,
min_point_range integer,
max_point_range integer,
staff_salary real
);
ALTER TABLE public.staff_rank_classification OWNER TO postgres;
CREATE SEQUENCE staff_rank_classification_staff_rank_classification_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.staff_rank_classification_staff_rank_classification_id_seq OWNER TO postgres;
ALTER SEQUENCE staff_rank_classification_staff_rank_classification_id_seq OWNED BY staff_rank_classification.staff_rank_classification_id;
CREATE TABLE status (
status_id integer NOT NULL,
employee_id integer,
start_date date,
active boolean DEFAULT true,
employee_status character varying,
end_date date
);
ALTER TABLE public.status OWNER TO postgres;
CREATE SEQUENCE status_status_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.status_status_id_seq OWNER TO postgres;
ALTER SEQUENCE status_status_id_seq OWNED BY status.status_id;
CREATE TABLE user_type (
user_id integer NOT NULL,
type character varying(20),
description character varying(100)
);
ALTER TABLE public.user_type OWNER TO postgres;
CREATE SEQUENCE user_type_user_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.user_type_user_id_seq OWNER TO postgres;
ALTER SEQUENCE user_type_user_id_seq OWNED BY user_type.user_id;
CREATE TABLE weight_multiplier (
weight_multiplier_id integer NOT NULL,
criteria_id integer,
employee_type_id integer,
weight real
);
ALTER TABLE public.weight_multiplier OWNER TO postgres;
CREATE SEQUENCE weight_multiplier_weight_multiplier_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.weight_multiplier_weight_multiplier_id_seq OWNER TO postgres;
ALTER SEQUENCE weight_multiplier_weight_multiplier_id_seq OWNED BY weight_multiplier.weight_multiplier_id;
CREATE TABLE work (
work_id integer NOT NULL,
employee_id integer,
employer character varying,
work_duration integer,
work_type_experience_id integer,
previous_work_start_date date
);
ALTER TABLE public.work OWNER TO postgres;
CREATE TABLE work_experience (
work_experience_id integer NOT NULL,
employee_type_id integer,
work_points integer,
work_min_months integer,
work_max_months integer,
work_type_experience_id integer
);
ALTER TABLE public.work_experience OWNER TO postgres;
CREATE SEQUENCE work_experience_work_experience_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.work_experience_work_experience_id_seq OWNER TO postgres;
ALTER SEQUENCE work_experience_work_experience_id_seq OWNED BY work_experience.work_experience_id;
CREATE TABLE work_type_experience (
work_type_experience_id integer NOT NULL,
work_type character varying
);
ALTER TABLE public.work_type_experience OWNER TO postgres;
CREATE SEQUENCE work_type_experience_work_type_experience_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.work_type_experience_work_type_experience_id_seq OWNER TO postgres;
ALTER SEQUENCE work_type_experience_work_type_experience_id_seq OWNED BY work_type_experience.work_type_experience_id;
CREATE SEQUENCE work_work_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.work_work_id_seq OWNER TO postgres;
ALTER SEQUENCE work_work_id_seq OWNED BY work.work_id;
CREATE TABLE year (
year_id integer NOT NULL,
start_date date,
end_date date,
current_year integer,
active boolean DEFAULT true
);
ALTER TABLE public.year OWNER TO postgres;
CREATE SEQUENCE year_year_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.year_year_id_seq OWNER TO postgres;
ALTER SEQUENCE year_year_id_seq OWNED BY year.year_id;
ALTER TABLE ONLY academic_year ALTER COLUMN academic_year_id SET DEFAULT nextval('school_year_school_year_id_seq'::regclass);
ALTER TABLE ONLY base_benefit ALTER COLUMN base_benefit_id SET DEFAULT nextval('base_benefit_base_benefit_id_seq'::regclass);
ALTER TABLE ONLY base_leave ALTER COLUMN base_leave_id SET DEFAULT nextval('base_leave_base_leave_id_seq'::regclass);
ALTER TABLE ONLY base_points ALTER COLUMN base_points_id SET DEFAULT nextval('base_points_base_points_id_seq'::regclass);
ALTER TABLE ONLY certification_board ALTER COLUMN certification_board_id SET DEFAULT nextval('certification_board_certification_board_id_seq'::regclass);
ALTER TABLE ONLY certification_board_acquired ALTER COLUMN certification_board_acquired_id SET DEFAULT nextval('certification_board_acquired_certification_board_acquired_i_seq'::regclass);
ALTER TABLE ONLY certification_board_detail ALTER COLUMN certification_board_detail_id SET DEFAULT nextval('certification_board_detail_certification_board_detail_id_seq'::regclass);
ALTER TABLE ONLY certification_board_type ALTER COLUMN certification_board_type_id SET DEFAULT nextval('certification_board_type_certification_board_type_id_seq'::regclass);
ALTER TABLE ONLY criteria ALTER COLUMN criteria_id SET DEFAULT nextval('criteria_criteria_id_seq'::regclass);
ALTER TABLE ONLY education ALTER COLUMN education_id SET DEFAULT nextval('education_education_id_seq'::regclass);
ALTER TABLE ONLY education_detail ALTER COLUMN education_detail_id SET DEFAULT nextval('education_detail_id_education_detail_id_seq'::regclass);
ALTER TABLE ONLY education_level ALTER COLUMN education_level_id SET DEFAULT nextval('education_level_education_level_id_seq'::regclass);
ALTER TABLE ONLY educational_attainment ALTER COLUMN educational_attainment_id SET DEFAULT nextval('educational_attainment_educational_attainment_id_seq'::regclass);
ALTER TABLE ONLY employee_information ALTER COLUMN employee_id SET DEFAULT nextval('employee_information_employee_id_seq'::regclass);
ALTER TABLE ONLY employee_medical_record ALTER COLUMN employee_medical_record_id SET DEFAULT nextval('employee_medical_record_employee_medical_record_id_seq'::regclass);
ALTER TABLE ONLY employee_record ALTER COLUMN employee_record_id SET DEFAULT nextval('employee_record_employee_record_id_seq'::regclass);
ALTER TABLE ONLY employee_type ALTER COLUMN employee_type_id SET DEFAULT nextval('employee_type_employee_type_id_seq'::regclass);
ALTER TABLE ONLY employee_type_history ALTER COLUMN employee_type_history_id SET DEFAULT nextval('employee_type_history_employee_type_history_id_seq'::regclass);
ALTER TABLE ONLY faculty_rank ALTER COLUMN faculty_rank_id SET DEFAULT nextval('faculty_rank_faculty_rank_id_seq'::regclass);
ALTER TABLE ONLY faculty_rank_classification ALTER COLUMN faculty_rank_classification_id SET DEFAULT nextval('faculty_rank_classification_faculty_rank_classification_id_seq'::regclass);
ALTER TABLE ONLY holiday ALTER COLUMN holiday_id SET DEFAULT nextval('holiday_holiday_id_seq'::regclass);
ALTER TABLE ONLY holiday_type ALTER COLUMN holiday_type_id SET DEFAULT nextval('holiday_type_holiday_type_id_seq'::regclass);
ALTER TABLE ONLY job_position ALTER COLUMN job_position_id SET DEFAULT nextval('staff_position_staff_position_id_seq'::regclass);
ALTER TABLE ONLY leave ALTER COLUMN leave_type_id SET DEFAULT nextval('leave_leave_type_id_seq'::regclass);
ALTER TABLE ONLY leave ALTER COLUMN leave_id SET DEFAULT nextval('leave_leave_id_seq'::regclass);
ALTER TABLE ONLY leave ALTER COLUMN employee_id SET DEFAULT nextval('leave_employee_id_seq'::regclass);
ALTER TABLE ONLY leave_type ALTER COLUMN leave_type_id SET DEFAULT nextval('leave_type_leave_type_id_seq'::regclass);
ALTER TABLE ONLY level ALTER COLUMN level_id SET DEFAULT nextval('level_level_id_seq'::regclass);
ALTER TABLE ONLY medical ALTER COLUMN medical_id SET DEFAULT nextval('medical_medical_id_seq'::regclass);
ALTER TABLE ONLY medical_receipt ALTER COLUMN medical_receipt_id SET DEFAULT nextval('medical_receipt_medical_receipt_id_seq'::regclass);
ALTER TABLE ONLY rank ALTER COLUMN rank_id SET DEFAULT nextval('rank_rank_id_seq'::regclass);
ALTER TABLE ONLY rank_date ALTER COLUMN rank_date_id SET DEFAULT nextval('rank_date_rank_date_id_seq'::regclass);
ALTER TABLE ONLY staff_job_grade ALTER COLUMN staff_job_grade_id SET DEFAULT nextval('staff_job_grade_staff_job_grade_id_seq'::regclass);
ALTER TABLE ONLY staff_rank_classification ALTER COLUMN staff_rank_classification_id SET DEFAULT nextval('staff_rank_classification_staff_rank_classification_id_seq'::regclass);
ALTER TABLE ONLY status ALTER COLUMN status_id SET DEFAULT nextval('status_status_id_seq'::regclass);
ALTER TABLE ONLY user_type ALTER COLUMN user_id SET DEFAULT nextval('user_type_user_id_seq'::regclass);
ALTER TABLE ONLY weight_multiplier ALTER COLUMN weight_multiplier_id SET DEFAULT nextval('weight_multiplier_weight_multiplier_id_seq'::regclass);
ALTER TABLE ONLY work ALTER COLUMN work_id SET DEFAULT nextval('work_work_id_seq'::regclass);
ALTER TABLE ONLY work_experience ALTER COLUMN work_experience_id SET DEFAULT nextval('work_experience_work_experience_id_seq'::regclass);
ALTER TABLE ONLY work_type_experience ALTER COLUMN work_type_experience_id SET DEFAULT nextval('work_type_experience_work_type_experience_id_seq'::regclass);
ALTER TABLE ONLY year ALTER COLUMN year_id SET DEFAULT nextval('year_year_id_seq'::regclass);
ALTER TABLE ONLY base_benefit
ADD CONSTRAINT base_benefit_pkey PRIMARY KEY (base_benefit_id);
ALTER TABLE ONLY base_leave
ADD CONSTRAINT base_leave_pkey PRIMARY KEY (base_leave_id);
ALTER TABLE ONLY base_points
ADD CONSTRAINT base_points_pkey PRIMARY KEY (base_points_id);
ALTER TABLE ONLY certification_board_acquired
ADD CONSTRAINT certification_board_acquired_pkey PRIMARY KEY (certification_board_acquired_id);
ALTER TABLE ONLY certification_board_detail
ADD CONSTRAINT certification_board_detail_pkey PRIMARY KEY (certification_board_detail_id);
ALTER TABLE ONLY certification_board
ADD CONSTRAINT certification_board_pkey PRIMARY KEY (certification_board_id);
ALTER TABLE ONLY certification_board_type
ADD CONSTRAINT certification_board_type_pkey PRIMARY KEY (certification_board_type_id);
ALTER TABLE ONLY criteria
ADD CONSTRAINT criteria_pkey PRIMARY KEY (criteria_id);
ALTER TABLE ONLY education_detail
ADD CONSTRAINT education_detail_id_pkey PRIMARY KEY (education_detail_id);
ALTER TABLE ONLY education_level
ADD CONSTRAINT education_level_pkey PRIMARY KEY (education_level_id);
ALTER TABLE ONLY education
ADD CONSTRAINT education_pkey PRIMARY KEY (education_id);
ALTER TABLE ONLY educational_attainment
ADD CONSTRAINT educational_attainment_pkey PRIMARY KEY (educational_attainment_id);
ALTER TABLE ONLY employee_information
ADD CONSTRAINT employee_information_pkey PRIMARY KEY (employee_id);
ALTER TABLE ONLY employee_medical_record
ADD CONSTRAINT employee_medical_record_pkey PRIMARY KEY (employee_medical_record_id);
ALTER TABLE ONLY employee_record
ADD CONSTRAINT employee_record_pkey PRIMARY KEY (employee_record_id);
ALTER TABLE ONLY employee_type_history
ADD CONSTRAINT employee_type_history_pkey PRIMARY KEY (employee_type_history_id);
ALTER TABLE ONLY employee_type
ADD CONSTRAINT employee_type_pkey PRIMARY KEY (employee_type_id);
ALTER TABLE ONLY faculty_rank_classification
ADD CONSTRAINT faculty_rank_classification_pkey PRIMARY KEY (faculty_rank_classification_id);
ALTER TABLE ONLY faculty_rank
ADD CONSTRAINT faculty_rank_pkey PRIMARY KEY (faculty_rank_id);
ALTER TABLE ONLY holiday
ADD CONSTRAINT holiday_pkey PRIMARY KEY (holiday_id);
ALTER TABLE ONLY holiday_type
ADD CONSTRAINT holiday_type_pkey PRIMARY KEY (holiday_type_id);
ALTER TABLE ONLY leave
ADD CONSTRAINT leave_pkey PRIMARY KEY (leave_id);
ALTER TABLE ONLY leave_type
ADD CONSTRAINT leave_type_pkey PRIMARY KEY (leave_type_id);
ALTER TABLE ONLY level
ADD CONSTRAINT level_pkey PRIMARY KEY (level_id);
ALTER TABLE ONLY medical
ADD CONSTRAINT medical_pkey PRIMARY KEY (medical_id);
ALTER TABLE ONLY medical_receipt
ADD CONSTRAINT medical_receipt_pkey PRIMARY KEY (medical_receipt_id);
ALTER TABLE ONLY rank_date
ADD CONSTRAINT rank_date_pkey PRIMARY KEY (rank_date_id);
ALTER TABLE ONLY rank
ADD CONSTRAINT rank_pkey PRIMARY KEY (rank_id);
ALTER TABLE ONLY academic_year
ADD CONSTRAINT school_year_pkey PRIMARY KEY (academic_year_id);
ALTER TABLE ONLY staff_job_grade
ADD CONSTRAINT staff_job_grade_pkey PRIMARY KEY (staff_job_grade_id);
ALTER TABLE ONLY job_position
ADD CONSTRAINT staff_position_pkey PRIMARY KEY (job_position_id);
ALTER TABLE ONLY staff_rank_classification
ADD CONSTRAINT staff_rank_classification_pkey PRIMARY KEY (staff_rank_classification_id);
ALTER TABLE ONLY status
ADD CONSTRAINT status_pkey PRIMARY KEY (status_id);
ALTER TABLE ONLY user_type
ADD CONSTRAINT user_type_pkey PRIMARY KEY (user_id);
ALTER TABLE ONLY weight_multiplier
ADD CONSTRAINT weight_multiplier_pkey PRIMARY KEY (weight_multiplier_id);
ALTER TABLE ONLY work_experience
ADD CONSTRAINT work_experience_pkey PRIMARY KEY (work_experience_id);
ALTER TABLE ONLY work
ADD CONSTRAINT work_pkey PRIMARY KEY (work_id);
ALTER TABLE ONLY work_type_experience
ADD CONSTRAINT work_type_experience_pkey PRIMARY KEY (work_type_experience_id);
ALTER TABLE ONLY year
ADD CONSTRAINT year_pkey PRIMARY KEY (year_id);
ALTER TABLE ONLY base_leave
ADD CONSTRAINT employee_type_id_base FOREIGN KEY (employee_type_id) REFERENCES employee_type(employee_type_id);
ALTER TABLE ONLY leave
ADD CONSTRAINT fk_academic_year_leave FOREIGN KEY (academic_year_id) REFERENCES academic_year(academic_year_id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY employee_medical_record
ADD CONSTRAINT fk_base_benefit FOREIGN KEY (base_benefit_id) REFERENCES base_benefit(base_benefit_id);
ALTER TABLE ONLY medical
ADD CONSTRAINT fk_base_benefit_id FOREIGN KEY (base_benefit_id) REFERENCES base_benefit(base_benefit_id);
ALTER TABLE ONLY leave
ADD CONSTRAINT fk_base_leave_id FOREIGN KEY (base_leave_id) REFERENCES base_leave(base_leave_id);
ALTER TABLE ONLY certification_board
ADD CONSTRAINT fk_certification_board_detail_id FOREIGN KEY (certification_board_detail_id) REFERENCES certification_board_detail(certification_board_detail_id);
ALTER TABLE ONLY certification_board_acquired
ADD CONSTRAINT fk_certification_board_id_cert FOREIGN KEY (certification_board_id) REFERENCES certification_board(certification_board_id);
ALTER TABLE ONLY certification_board
ADD CONSTRAINT fk_certification_board_type_id FOREIGN KEY (certification_board_type_id) REFERENCES certification_board_type(certification_board_type_id);
ALTER TABLE ONLY weight_multiplier
ADD CONSTRAINT fk_criteria_id FOREIGN KEY (criteria_id) REFERENCES criteria(criteria_id);
ALTER TABLE ONLY base_points
ADD CONSTRAINT fk_criteria_id_base FOREIGN KEY (criteria_id) REFERENCES criteria(criteria_id);
ALTER TABLE ONLY educational_attainment
ADD CONSTRAINT fk_education_detail_id FOREIGN KEY (education_detail_id) REFERENCES education_detail(education_detail_id);
ALTER TABLE ONLY faculty_rank_classification
ADD CONSTRAINT fk_education_level FOREIGN KEY (education_requirement_id) REFERENCES education_level(education_level_id);
ALTER TABLE ONLY educational_attainment
ADD CONSTRAINT fk_education_level_id FOREIGN KEY (education_level_id) REFERENCES education_level(education_level_id);
ALTER TABLE ONLY education
ADD CONSTRAINT fk_educational_attainment_id_education FOREIGN KEY (educational_attainment_id) REFERENCES educational_attainment(educational_attainment_id);
ALTER TABLE ONLY status
ADD CONSTRAINT fk_employee_id FOREIGN KEY (employee_id) REFERENCES employee_information(employee_id) ON DELETE CASCADE;
ALTER TABLE ONLY leave
ADD CONSTRAINT fk_employee_id FOREIGN KEY (employee_id) REFERENCES employee_information(employee_id) ON DELETE CASCADE;