-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathattendance-1.0-oracle.sql
159 lines (139 loc) · 6.33 KB
/
attendance-1.0-oracle.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
--------------------------------------------------------
-- File created - Friday-February-05-2016
--------------------------------------------------------
--------------------------------------------------------
-- DDL for Table ATTENDANCE_EVENT_T
--------------------------------------------------------
CREATE TABLE "ATTENDANCE_EVENT_T"
( "A_EVENT_ID" NUMBER(19,0),
"NAME" VARCHAR2(255 CHAR),
"START_DATE_TIME" TIMESTAMP (6),
"END_DATE_TIME" TIMESTAMP (6),
"IS_REOCCURRING" NUMBER(1,0),
"REOCCURRING_ID" NUMBER(19,0),
"IS_REQUIRED" NUMBER(1,0),
"RELEASED_TO" VARCHAR2(255 CHAR),
"LOCATION" VARCHAR2(255 CHAR),
"A_SITE_ID" NUMBER(19,0)
);
--------------------------------------------------------
-- DDL for Table ATTENDANCE_GRADE_T
--------------------------------------------------------
CREATE TABLE "ATTENDANCE_GRADE_T"
( "A_GRADE_ID" NUMBER(19,0),
"GRADE" FLOAT(126),
"USER_ID" VARCHAR2(255 CHAR),
"A_SITE_ID" NUMBER(19,0)
);
--------------------------------------------------------
-- DDL for Table ATTENDANCE_RECORD_T
--------------------------------------------------------
CREATE TABLE "ATTENDANCE_RECORD_T"
( "A_RECORD_ID" NUMBER(19,0),
"USER_ID" VARCHAR2(255 CHAR),
"STATUS" VARCHAR2(255 CHAR),
"A_EVENT_ID" NUMBER(19,0),
"RECORD_COMMENT" CLOB
);
--------------------------------------------------------
-- DDL for Table ATTENDANCE_SITE_T
--------------------------------------------------------
CREATE TABLE "ATTENDANCE_SITE_T"
( "A_SITE_ID" NUMBER(19,0),
"SITE_ID" VARCHAR2(255 CHAR),
"DEFAULT_STATUS" VARCHAR2(255 CHAR),
"MAXIMUM_GRADE" FLOAT(126),
"IS_GRADE_SHOWN" NUMBER(1,0),
"SEND_TO_GRADEBOOK" NUMBER(1,0),
"GRADEBOOK_ITEM_NAME" VARCHAR2(255 CHAR),
"SHOW_COMMENTS" NUMBER(1,0)
);
--------------------------------------------------------
-- DDL for Table ATTENDANCE_STATUS_T
--------------------------------------------------------
CREATE TABLE "ATTENDANCE_STATUS_T"
( "A_STATUS_ID" NUMBER(19,0),
"IS_ACTIVE" NUMBER(1,0),
"STATUS" VARCHAR2(255 CHAR),
"SORT_ORDER" NUMBER(10,0),
"A_SITE_ID" NUMBER(19,0)
);
--------------------------------------------------------
-- DDL for Index UNQ_ATTD_EVENT
--------------------------------------------------------
CREATE UNIQUE INDEX "UNQ_ATTD_EVENT" ON "ATTENDANCE_EVENT_T" ("A_EVENT_ID")
;
--------------------------------------------------------
-- DDL for Index UNQ_ATTD_GRADE
--------------------------------------------------------
CREATE UNIQUE INDEX "UNQ_ATTD_GRADE" ON "ATTENDANCE_GRADE_T" ("A_GRADE_ID")
;
--------------------------------------------------------
-- DDL for Index UNQ_ATTD_RECORD
--------------------------------------------------------
CREATE UNIQUE INDEX "UNQ_ATTD_RECORD" ON "ATTENDANCE_RECORD_T" ("A_RECORD_ID")
;
--------------------------------------------------------
-- DDL for Index UNQ_ATTD_SITE
--------------------------------------------------------
CREATE UNIQUE INDEX "UNQ_ATTD_SITE" ON "ATTENDANCE_SITE_T" ("A_SITE_ID")
;
--------------------------------------------------------
-- DDL for Index UNQ_ATTD_STATUS
--------------------------------------------------------
CREATE UNIQUE INDEX "UNQ_ATTD_STATUS" ON "ATTENDANCE_STATUS_T" ("A_STATUS_ID")
;
--------------------------------------------------------
-- Constraints for Table ATTENDANCE_EVENT_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_EVENT_T" ADD PRIMARY KEY ("A_EVENT_ID")
USING INDEX ENABLE;
ALTER TABLE "ATTENDANCE_EVENT_T" MODIFY ("A_SITE_ID" NOT NULL ENABLE);
ALTER TABLE "ATTENDANCE_EVENT_T" MODIFY ("A_EVENT_ID" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table ATTENDANCE_GRADE_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_GRADE_T" ADD PRIMARY KEY ("A_GRADE_ID")
USING INDEX ENABLE;
ALTER TABLE "ATTENDANCE_GRADE_T" MODIFY ("A_SITE_ID" NOT NULL ENABLE);
ALTER TABLE "ATTENDANCE_GRADE_T" MODIFY ("A_GRADE_ID" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table ATTENDANCE_RECORD_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_RECORD_T" ADD PRIMARY KEY ("A_RECORD_ID")
USING INDEX ENABLE;
ALTER TABLE "ATTENDANCE_RECORD_T" MODIFY ("A_EVENT_ID" NOT NULL ENABLE);
ALTER TABLE "ATTENDANCE_RECORD_T" MODIFY ("A_RECORD_ID" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table ATTENDANCE_SITE_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_SITE_T" ADD PRIMARY KEY ("A_SITE_ID")
USING INDEX ENABLE;
ALTER TABLE "ATTENDANCE_SITE_T" MODIFY ("A_SITE_ID" NOT NULL ENABLE);
--------------------------------------------------------
-- Constraints for Table ATTENDANCE_STATUS_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_STATUS_T" ADD PRIMARY KEY ("A_STATUS_ID")
USING INDEX ENABLE;
ALTER TABLE "ATTENDANCE_STATUS_T" MODIFY ("A_SITE_ID" NOT NULL ENABLE);
ALTER TABLE "ATTENDANCE_STATUS_T" MODIFY ("A_STATUS_ID" NOT NULL ENABLE);
--------------------------------------------------------
-- Ref Constraints for Table ATTENDANCE_EVENT_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_EVENT_T" ADD CONSTRAINT "FK1_ATTD_EVENT" FOREIGN KEY ("A_SITE_ID")
REFERENCES "ATTENDANCE_SITE_T" ("A_SITE_ID") ENABLE;
--------------------------------------------------------
-- Ref Constraints for Table ATTENDANCE_GRADE_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_GRADE_T" ADD CONSTRAINT "FK1_ATTD_GRADE" FOREIGN KEY ("A_SITE_ID")
REFERENCES "ATTENDANCE_SITE_T" ("A_SITE_ID") ENABLE;
--------------------------------------------------------
-- Ref Constraints for Table ATTENDANCE_RECORD_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_RECORD_T" ADD CONSTRAINT "FK1_ATTD_RECORD" FOREIGN KEY ("A_EVENT_ID")
REFERENCES "ATTENDANCE_EVENT_T" ("A_EVENT_ID") ENABLE;
--------------------------------------------------------
-- Ref Constraints for Table ATTENDANCE_STATUS_T
--------------------------------------------------------
ALTER TABLE "ATTENDANCE_STATUS_T" ADD CONSTRAINT "FK1_ATTD_STATUS" FOREIGN KEY ("A_SITE_ID")
REFERENCES "ATTENDANCE_SITE_T" ("A_SITE_ID") ENABLE;