1-- created with "charts3 django_manage sqlmigrate auth 0001"
2
3-- For S3 hybrid dev:
4-- Enter value for schema: S3_HYBRID_DEV_ADM
5-- Enter value for tablespace: S3_HYBRID_DEV
6
7--
8-- Create model Permission
9--
10CREATE TABLE "&&schema"."AUTH_PERMISSION" ("ID" NUMBER(11) NOT NULL PRIMARY KEY, "NAME" NVARCHAR2(50) NULL, "CONTENT_TYPE_ID" NUMBER(11) NOT NULL, "CODENAME" NVARCHAR2(100) NULL) TABLESPACE &&tablespace;
11--
12-- Create model Group
13--
14CREATE TABLE "&&schema"."AUTH_GROUP" ("ID" NUMBER(11) NOT NULL PRIMARY KEY, "NAME" NVARCHAR2(80) NULL UNIQUE) TABLESPACE &&tablespace;
15CREATE TABLE "&&schema"."AUTH_GROUP_PERMISSIONS" ("ID" NUMBER(11) NOT NULL PRIMARY KEY, "GROUP_ID" NUMBER(11) NOT NULL, "PERMISSION_ID" NUMBER(11) NOT NULL) TABLESPACE &&tablespace;
16--
17-- Create model User
18--
19<<<hidden due to potential security issue>>>
20CREATE TABLE "&&schema"."AUTH_USER_GROUPS" ("ID" NUMBER(11) NOT NULL PRIMARY KEY, "USER_ID" NUMBER(11) NOT NULL, "GROUP_ID" NUMBER(11) NOT NULL) TABLESPACE &&tablespace;
21CREATE TABLE "&&schema"."AUTH_USER_USER_PERMISSIONS" ("ID" NUMBER(11) NOT NULL PRIMARY KEY, "USER_ID" NUMBER(11) NOT NULL, "PERMISSION_ID" NUMBER(11) NOT NULL) TABLESPACE &&tablespace;
22-- DECLARE
23 -- i INTEGER;
24-- BEGIN
25 -- SELECT COUNT(1) INTO i FROM USER_SEQUENCES
26 -- WHERE SEQUENCE_NAME = 'AUTH_PERMISSION_SQ';
27 -- IF i = 0 THEN
28 -- EXECUTE IMMEDIATE 'CREATE SEQUENCE "&&schema"."AUTH_PERMISSION_SQ"';
29CREATE SEQUENCE "&&schema"."AUTH_PERMISSION_SQ";
30 -- END IF;
31-- END;
32-- /;
33CREATE OR REPLACE TRIGGER "&&schema"."AUTH_PERMISSION_TR"
34BEFORE INSERT ON "&&schema"."AUTH_PERMISSION"
35FOR EACH ROW
36WHEN (new."ID" IS NULL)
37 BEGIN
38 SELECT "&&schema"."AUTH_PERMISSION_SQ".nextval
39 INTO :new."ID" FROM dual;
40 END;
41/
42ALTER TABLE "&&schema"."AUTH_PERMISSION" ADD CONSTRAINT "AUTH_PERM_CONTENT_T_2F476E4B_F" FOREIGN KEY ("CONTENT_TYPE_ID") REFERENCES "&&schema"."DJANGO_CONTENT_TYPE" ("ID") DEFERRABLE INITIALLY DEFERRED;
43ALTER TABLE "&&schema"."AUTH_PERMISSION" ADD CONSTRAINT "AUTH_PERM_CONTENT_T_01AB375A_U" UNIQUE ("CONTENT_TYPE_ID", "CODENAME");
44CREATE INDEX "AUTH_PERMI_CONTENT_TY_2F476E4B" ON "&&schema"."AUTH_PERMISSION" ("CONTENT_TYPE_ID") TABLESPACE &&tablespace;
45
46-- DECLARE
47 -- i INTEGER;
48-- BEGIN
49 -- SELECT COUNT(1) INTO i FROM USER_SEQUENCES
50 -- WHERE SEQUENCE_NAME = 'AUTH_GROUP_SQ';
51 -- IF i = 0 THEN
52CREATE SEQUENCE "&&schema"."AUTH_GROUP_SQ";
53 -- EXECUTE IMMEDIATE 'CREATE SEQUENCE "&&schema"."AUTH_GROUP_SQ"';
54 -- END IF;
55-- END;
56-- /;
57
58CREATE OR REPLACE TRIGGER "&&schema"."AUTH_GROUP_TR"
59BEFORE INSERT ON "&&schema"."AUTH_GROUP"
60FOR EACH ROW
61WHEN (new."ID" IS NULL)
62 BEGIN
63 SELECT "&&schema"."AUTH_GROUP_SQ".nextval
64 INTO :new."ID" FROM dual;
65 END;
66/
67
68 -- DECLARE
69 -- i INTEGER;
70-- BEGIN
71 -- SELECT COUNT(1) INTO i FROM USER_SEQUENCES
72 -- WHERE SEQUENCE_NAME = 'AUTH_GROUP_PERMISSIONS_SQ';
73 -- IF i = 0 THEN
74CREATE SEQUENCE "&&schema"."AUTH_GROUP_PERMISSIONS_SQ";
75 -- EXECUTE IMMEDIATE 'CREATE SEQUENCE "&&schema"."AUTH_GROUP_PERMISSIONS_SQ"';
76 -- END IF;
77-- END;
78-- /;
79
80CREATE OR REPLACE TRIGGER "&&schema"."AUTH_GROUP_PERMISSIONS_TR"
81BEFORE INSERT ON "&&schema"."AUTH_GROUP_PERMISSIONS"
82FOR EACH ROW
83WHEN (new."ID" IS NULL)
84 BEGIN
85 SELECT "&&schema"."AUTH_GROUP_PERMISSIONS_SQ".nextval
86 INTO :new."ID" FROM dual;
87 END;
88/
89
90ALTER TABLE "&&schema"."AUTH_GROUP_PERMISSIONS" ADD CONSTRAINT "AUTH_GROU_GROUP_ID_B120CBF9_F" FOREIGN KEY ("GROUP_ID") REFERENCES "&&schema"."AUTH_GROUP" ("ID") DEFERRABLE INITIALLY DEFERRED;
91ALTER TABLE "&&schema"."AUTH_GROUP_PERMISSIONS" ADD CONSTRAINT "AUTH_GROU_PERMISSIO_84C5C92E_F" FOREIGN KEY ("PERMISSION_ID") REFERENCES "&&schema"."AUTH_PERMISSION" ("ID") DEFERRABLE INITIALLY DEFERRED;
92ALTER TABLE "&&schema"."AUTH_GROUP_PERMISSIONS" ADD CONSTRAINT "AUTH_GROU_GROUP_ID__0CD325B0_U" UNIQUE ("GROUP_ID", "PERMISSION_ID");
93CREATE INDEX "AUTH_GROUP_GROUP_ID_B120CBF9" ON "&&schema"."AUTH_GROUP_PERMISSIONS" ("GROUP_ID") TABLESPACE &&tablespace;
94CREATE INDEX "AUTH_GROUP_PERMISSION_84C5C92E" ON "&&schema"."AUTH_GROUP_PERMISSIONS" ("PERMISSION_ID") TABLESPACE &&tablespace;
95
96-- DECLARE
97 -- i INTEGER;
98-- BEGIN
99 -- SELECT COUNT(1) INTO i FROM USER_SEQUENCES
100 -- WHERE SEQUENCE_NAME = 'AUTH_USER_SQ';
101 -- IF i = 0 THEN
102CREATE SEQUENCE "&&schema"."AUTH_USER_SQ";
103 -- EXECUTE IMMEDIATE 'CREATE SEQUENCE "&&schema"."AUTH_USER_SQ"';
104 -- END IF;
105-- END;
106-- /;
107
108CREATE OR REPLACE TRIGGER "&&schema"."AUTH_USER_TR"
109BEFORE INSERT ON "&&schema"."AUTH_USER"
110FOR EACH ROW
111WHEN (new."ID" IS NULL)
112 BEGIN
113 SELECT "&&schema"."AUTH_USER_SQ".nextval
114 INTO :new."ID" FROM dual;
115 END;
116/
117
118-- DECLARE
119 -- i INTEGER;
120-- BEGIN
121 -- SELECT COUNT(1) INTO i FROM USER_SEQUENCES
122 -- WHERE SEQUENCE_NAME = 'AUTH_USER_GROUPS_SQ';
123 -- IF i = 0 THEN
124CREATE SEQUENCE "&&schema"."AUTH_USER_GROUPS_SQ";
125 -- EXECUTE IMMEDIATE 'CREATE SEQUENCE "&&schema"."AUTH_USER_GROUPS_SQ"';
126 -- END IF;
127-- END;
128-- /;
129
130CREATE OR REPLACE TRIGGER "&&schema"."AUTH_USER_GROUPS_TR"
131BEFORE INSERT ON "&&schema"."AUTH_USER_GROUPS"
132FOR EACH ROW
133WHEN (new."ID" IS NULL)
134 BEGIN
135 SELECT "&&schema"."AUTH_USER_GROUPS_SQ".nextval
136 INTO :new."ID" FROM dual;
137 END;
138/
139ALTER TABLE "&&schema"."AUTH_USER_GROUPS" ADD CONSTRAINT "AUTH_USER_USER_ID_6A12ED8B_F" FOREIGN KEY ("USER_ID") REFERENCES "&&schema"."AUTH_USER" ("ID") DEFERRABLE INITIALLY DEFERRED;
140ALTER TABLE "&&schema"."AUTH_USER_GROUPS" ADD CONSTRAINT "AUTH_USER_GROUP_ID_97559544_F" FOREIGN KEY ("GROUP_ID") REFERENCES "&&schema"."AUTH_GROUP" ("ID") DEFERRABLE INITIALLY DEFERRED;
141ALTER TABLE "&&schema"."AUTH_USER_GROUPS" ADD CONSTRAINT "AUTH_USER_USER_ID_G_94350C0C_U" UNIQUE ("USER_ID", "GROUP_ID");
142CREATE INDEX "&&schema"."AUTH_USER__USER_ID_6A12ED8B" ON "AUTH_USER_GROUPS" ("USER_ID") TABLESPACE &&tablespace;
143CREATE INDEX "&&schema"."AUTH_USER__GROUP_ID_97559544" ON "AUTH_USER_GROUPS" ("GROUP_ID") TABLESPACE &&tablespace;
144
145-- DECLARE
146 -- i INTEGER;
147-- BEGIN
148 -- SELECT COUNT(1) INTO i FROM USER_SEQUENCES
149 -- WHERE SEQUENCE_NAME = 'AUTH_USER_USER_PERMISSI7B1E';
150 -- IF i = 0 THEN
151CREATE SEQUENCE "&&schema"."AUTH_USER_USER_PERMISSI7B1E";
152 -- EXECUTE IMMEDIATE 'CREATE SEQUENCE "&&schema"."AUTH_USER_USER_PERMISSI7B1E"';
153 -- END IF;
154-- END;
155-- /;
156
157CREATE OR REPLACE TRIGGER "&&schema"."AUTH_USER_USER_PERMISSI17F3"
158BEFORE INSERT ON "&&schema"."AUTH_USER_USER_PERMISSIONS"
159FOR EACH ROW
160WHEN (new."ID" IS NULL)
161 BEGIN
162 SELECT "&&schema"."AUTH_USER_USER_PERMISSI7B1E".nextval
163 INTO :new."ID" FROM dual;
164 END;
165/
166ALTER TABLE "&&schema"."AUTH_USER_USER_PERMISSIONS" ADD CONSTRAINT "AUTH_USER_USER_ID_A95EAD1B_F" FOREIGN KEY ("USER_ID") REFERENCES "&&schema"."AUTH_USER" ("ID") DEFERRABLE INITIALLY DEFERRED;
167ALTER TABLE "&&schema"."AUTH_USER_USER_PERMISSIONS" ADD CONSTRAINT "AUTH_USER_PERMISSIO_1FBB5F2C_F" FOREIGN KEY ("PERMISSION_ID") REFERENCES "&&schema"."AUTH_PERMISSION" ("ID") DEFERRABLE INITIALLY DEFERRED;
168ALTER TABLE "&&schema"."AUTH_USER_USER_PERMISSIONS" ADD CONSTRAINT "AUTH_USER_USER_ID_P_14A6B632_U" UNIQUE ("USER_ID", "PERMISSION_ID");
169CREATE INDEX "&&schema"."AUTH_USER__USER_ID_A95EAD1B" ON "AUTH_USER_USER_PERMISSIONS" ("USER_ID") TABLESPACE &&tablespace;
170CREATE INDEX "&&schema"."AUTH_USER__PERMISSION_1FBB5F2C" ON "AUTH_USER_USER_PERMISSIONS" ("PERMISSION_ID") TABLESPACE &&tablespace;
171COMMIT;