1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
---|
2 | <databaseChangeLog logicalFilePath="database-schema.xml" xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"> |
---|
3 | <changeSet author="fmguler" id="init"> |
---|
4 | </changeSet> |
---|
5 | <changeSet author="fmguler" id="0"> |
---|
6 | <tagDatabase tag="0"/> |
---|
7 | </changeSet> |
---|
8 | <!-- TEST SCHEMA >> --> |
---|
9 | <changeSet author="fmguler" id="1"> |
---|
10 | <createTable schemaName="public" tableName="aa_authorization_parameter"> |
---|
11 | <column autoIncrement="true" name="no" type="serial"> |
---|
12 | <constraints nullable="false" primaryKey="true" primaryKeyName="aa_authorization_parameter_pkey"/> |
---|
13 | </column> |
---|
14 | <column name="param_no" type="int4"> |
---|
15 | <constraints nullable="false"/> |
---|
16 | </column> |
---|
17 | <column name="attribute" type="VARCHAR(100)"/> |
---|
18 | <column name="operator" type="VARCHAR(100)"/> |
---|
19 | <column name="value" type="TEXT(2147483647)"/> |
---|
20 | <column name="connective" type="VARCHAR(10)"/> |
---|
21 | <column name="order" type="int4"> |
---|
22 | <constraints nullable="false"/> |
---|
23 | </column> |
---|
24 | </createTable> |
---|
25 | </changeSet> |
---|
26 | <changeSet author="fmguler" id="2"> |
---|
27 | <createTable schemaName="public" tableName="aa_group"> |
---|
28 | <column autoIncrement="true" name="no" type="serial"> |
---|
29 | <constraints nullable="false" primaryKey="true" primaryKeyName="aa_group_pkey"/> |
---|
30 | </column> |
---|
31 | <column name="name" type="VARCHAR(100)"> |
---|
32 | <constraints nullable="false"/> |
---|
33 | </column> |
---|
34 | <column name="description" type="VARCHAR(1000)"/> |
---|
35 | </createTable> |
---|
36 | </changeSet> |
---|
37 | <changeSet author="fmguler" id="3"> |
---|
38 | <createTable schemaName="public" tableName="aa_group_authorization"> |
---|
39 | <column name="auth_name" type="VARCHAR(100)"> |
---|
40 | <constraints nullable="false"/> |
---|
41 | </column> |
---|
42 | <column name="group_no" type="int4"> |
---|
43 | <constraints nullable="false"/> |
---|
44 | </column> |
---|
45 | <column name="param_no" type="int4"/> |
---|
46 | <column name="rule" type="int4"/> |
---|
47 | </createTable> |
---|
48 | </changeSet> |
---|
49 | <changeSet author="fmguler" id="4"> |
---|
50 | <createTable schemaName="public" tableName="aa_user_group"> |
---|
51 | <column name="username" type="VARCHAR(100)"> |
---|
52 | <constraints nullable="false"/> |
---|
53 | </column> |
---|
54 | <column name="group_no" type="int4"> |
---|
55 | <constraints nullable="false"/> |
---|
56 | </column> |
---|
57 | <column name="order" type="int4"> |
---|
58 | <constraints nullable="false"/> |
---|
59 | </column> |
---|
60 | </createTable> |
---|
61 | </changeSet> |
---|
62 | <changeSet author="fmguler" id="5"> |
---|
63 | <createTable schemaName="public" tableName="user_attribute"> |
---|
64 | <column autoIncrement="true" name="no" type="serial"> |
---|
65 | <constraints nullable="false" primaryKey="true" primaryKeyName="user_attribute_pkey"/> |
---|
66 | </column> |
---|
67 | <column autoIncrement="true" name="user_no" type="serial"> |
---|
68 | <constraints nullable="false"/> |
---|
69 | </column> |
---|
70 | <column name="attribute" type="VARCHAR(100)"/> |
---|
71 | <column name="value" type="TEXT(2147483647)"/> |
---|
72 | <column name="type" type="VARCHAR(100)"/> |
---|
73 | <column defaultValueNumeric="0" name="priority" type="int4"/> |
---|
74 | </createTable> |
---|
75 | </changeSet> |
---|
76 | <changeSet author="fmguler" id="6"> |
---|
77 | <createTable schemaName="public" tableName="user_authentication"> |
---|
78 | <column name="username" type="VARCHAR(150)"> |
---|
79 | <constraints nullable="false" primaryKey="true" primaryKeyName="user_authentication_pkey"/> |
---|
80 | </column> |
---|
81 | <column name="password" type="VARCHAR(150)"> |
---|
82 | <constraints nullable="false"/> |
---|
83 | </column> |
---|
84 | </createTable> |
---|
85 | </changeSet> |
---|
86 | <changeSet author="fmguler" id="7"> |
---|
87 | <createTable schemaName="public" tableName="user_operation"> |
---|
88 | <column autoIncrement="true" name="no" type="serial"> |
---|
89 | <constraints nullable="false" primaryKey="true" primaryKeyName="user_operation_pkey"/> |
---|
90 | </column> |
---|
91 | <column name="username" type="VARCHAR(100)"> |
---|
92 | <constraints nullable="false"/> |
---|
93 | </column> |
---|
94 | <column name="module" type="VARCHAR(100)"> |
---|
95 | <constraints nullable="false"/> |
---|
96 | </column> |
---|
97 | <column name="operation" type="VARCHAR(100)"> |
---|
98 | <constraints nullable="false"/> |
---|
99 | </column> |
---|
100 | <column defaultValueDate="now()" name="date" type="TIMESTAMP WITHOUT TIME ZONE"> |
---|
101 | <constraints nullable="false"/> |
---|
102 | </column> |
---|
103 | <column name="parameter" type="TEXT(2147483647)"/> |
---|
104 | </createTable> |
---|
105 | </changeSet> |
---|
106 | <changeSet author="fmguler" id="8"> |
---|
107 | <addPrimaryKey columnNames="auth_name, group_no" constraintName="aa_group_authorization_pkey" schemaName="public" tableName="aa_group_authorization"/> |
---|
108 | </changeSet> |
---|
109 | <changeSet author="fmguler" id="9"> |
---|
110 | <addPrimaryKey columnNames="username, group_no" constraintName="aa_user_group_pkey" schemaName="public" tableName="aa_user_group"/> |
---|
111 | </changeSet> |
---|
112 | <changeSet author="fmguler" id="10"> |
---|
113 | <addUniqueConstraint columnNames="user_no, attribute" constraintName="user_attribute_user_no_key" schemaName="public" tableName="user_attribute"/> |
---|
114 | </changeSet> |
---|
115 | <changeSet author="fmguler" id="11"> |
---|
116 | <createIndex indexName="aa_param_index" schemaName="public" tableName="aa_authorization_parameter" unique="false"> |
---|
117 | <column name="param_no"/> |
---|
118 | </createIndex> |
---|
119 | </changeSet> |
---|
120 | <changeSet author="fmguler" id="12"> |
---|
121 | <createIndex indexName="aa_param_index2" schemaName="public" tableName="aa_group_authorization" unique="false"> |
---|
122 | <column name="param_no"/> |
---|
123 | </createIndex> |
---|
124 | </changeSet> |
---|
125 | <changeSet author="fmguler" id="13"> |
---|
126 | <createIndex indexName="aa_auth_name_index" schemaName="public" tableName="aa_group_authorization" unique="false"> |
---|
127 | <column name="auth_name"/> |
---|
128 | </createIndex> |
---|
129 | </changeSet> |
---|
130 | <changeSet author="fmguler" id="14"> |
---|
131 | <createIndex indexName="aa_user_group_index" schemaName="public" tableName="aa_user_group" unique="false"> |
---|
132 | <column name="username"/> |
---|
133 | <column name="group_no"/> |
---|
134 | </createIndex> |
---|
135 | </changeSet> |
---|
136 | <changeSet author="fmguler" id="15"> |
---|
137 | <createIndex indexName="user_operation_index" schemaName="public" tableName="user_operation" unique="false"> |
---|
138 | <column name="username"/> |
---|
139 | <column name="module"/> |
---|
140 | <column name="operation"/> |
---|
141 | <column name="date"/> |
---|
142 | </createIndex> |
---|
143 | </changeSet> |
---|
144 | <changeSet author="fmguler" id="16"> |
---|
145 | <addForeignKeyConstraint baseColumnNames="group_no" baseTableName="aa_group_authorization" baseTableSchemaName="public" constraintName="aa_group_authorization_group_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="RESTRICT" referencedColumnNames="no" referencedTableName="aa_group" referencedTableSchemaName="public"/> |
---|
146 | </changeSet> |
---|
147 | <changeSet author="fmguler" id="17"> |
---|
148 | <createView schemaName="public" viewName="user_view"> |
---|
149 | <![CDATA[SELECT ua.user_no, u1.value AS username, u2.value AS full_name, u3.value AS receipt_signing_type, u4.value AS mobile_signature_phone_number, u5.value AS mobile_signature_credit FROM ((((((SELECT DISTINCT user_attribute.user_no FROM user_attribute ORDER BY user_attribute.user_no) ua LEFT JOIN (SELECT user_attribute.user_no, user_attribute.value FROM user_attribute WHERE ((user_attribute.attribute)::text = 'username'::text)) u1 ON ((ua.user_no = u1.user_no))) LEFT JOIN (SELECT user_attribute.user_no, user_attribute.value FROM user_attribute WHERE ((user_attribute.attribute)::text = 'fullName'::text)) u2 ON ((ua.user_no = u2.user_no))) LEFT JOIN (SELECT user_attribute.user_no, user_attribute.value FROM user_attribute WHERE ((user_attribute.attribute)::text = 'receiptSigningType'::text)) u3 ON ((ua.user_no = u3.user_no))) LEFT JOIN (SELECT user_attribute.user_no, user_attribute.value FROM user_attribute WHERE ((user_attribute.attribute)::text = 'mobileSignaturePhoneNumber'::text)) u4 ON ((ua.user_no = u4.user_no))) LEFT JOIN (SELECT user_attribute.user_no, user_attribute.value FROM user_attribute WHERE ((user_attribute.attribute)::text = 'mobileSignatureCredit'::text)) u5 ON ((ua.user_no = u5.user_no))) ORDER BY ua.user_no;]]> |
---|
150 | </createView> |
---|
151 | </changeSet> |
---|
152 | <changeSet author="fmguler" id="18"> |
---|
153 | <comment>SERIAL'ler serilerin sonuna _seq ekliyor, ama kodda oldugu gibi cagirabiliyoruz</comment> |
---|
154 | <sql> |
---|
155 | ALTER TABLE aa_authorization_parameter_no_seq RENAME TO aa_authorization_parameter_no; |
---|
156 | ALTER TABLE aa_group_no_seq RENAME TO aa_group_no; |
---|
157 | ALTER TABLE user_attribute_no_seq RENAME TO user_attribute_no; |
---|
158 | ALTER TABLE user_attribute_user_no_seq RENAME TO user_no; |
---|
159 | ALTER TABLE user_operation_no_seq RENAME TO user_operation_no; |
---|
160 | </sql> |
---|
161 | <rollback/> |
---|
162 | </changeSet> |
---|
163 | <changeSet author="fmguler" id="19"> |
---|
164 | <comment>Default Data</comment> |
---|
165 | <sql> |
---|
166 | INSERT INTO aa_group ("no", name, description) VALUES (1, 'Signomat Base Users', 'Signomat Base Users, have basic usage rights'); |
---|
167 | INSERT INTO aa_group ("no", name, description) VALUES (2, 'SignArt Client Users', 'SignArt Client Users, have access to CSP mobile signing facilities'); |
---|
168 | INSERT INTO aa_group ("no", name, description) VALUES (3, 'Workspace Users', 'Workspace Users, have access to /workspace web pages'); |
---|
169 | INSERT INTO aa_group ("no", name, description) VALUES (4, 'Dox Users', 'Dox Users, have access to /dox web pages'); |
---|
170 | INSERT INTO aa_group ("no", name, description) VALUES (5, 'Admin Users', 'Admin Users have access to /admin web pages'); |
---|
171 | INSERT INTO aa_group ("no", name, description) VALUES (6, 'Demo Users', 'Demo Users have limited access, no access to DoX, and no timestamp facilities in signing portal'); |
---|
172 | |
---|
173 | |
---|
174 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 1, NULL, 1); |
---|
175 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 2, NULL, 2); |
---|
176 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 3, NULL, 3); |
---|
177 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 4, NULL, 4); |
---|
178 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 5, NULL, 5); |
---|
179 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 6, NULL, 3); |
---|
180 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('SignAuth', 3, NULL, 1); |
---|
181 | INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('SignAuth', 6, NULL, 2); |
---|
182 | |
---|
183 | |
---|
184 | INSERT INTO user_attribute (attribute, value, "type", priority) VALUES ('username', 'admin', '00_id', 0); |
---|
185 | INSERT INTO user_attribute (user_no, attribute, value, "type", priority) VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 'citizenshipNumber', '12345', '00_id', 0); |
---|
186 | INSERT INTO user_authentication (username, "password") VALUES ('12345', '21232f297a57a5a743894a0e4a801fc3'); |
---|
187 | |
---|
188 | |
---|
189 | INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 1, 1); |
---|
190 | INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 3, 2); |
---|
191 | INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 4, 3); |
---|
192 | INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 5, 4); |
---|
193 | </sql> |
---|
194 | <rollback/> |
---|
195 | </changeSet> |
---|
196 | <changeSet author="fmguler" id="20" runOnChange="true"> |
---|
197 | <comment>Function to delete all data from all tables. Can be updated later (runAlways is set)</comment> |
---|
198 | <createProcedure><![CDATA[ |
---|
199 | --DROP FUNCTION db_delete_all_data(); |
---|
200 | CREATE OR REPLACE FUNCTION db_delete_all_data() RETURNS character varying |
---|
201 | LANGUAGE plpgsql |
---|
202 | AS 'DECLARE |
---|
203 | table_list VARCHAR(100000); |
---|
204 | mtable RECORD; |
---|
205 | BEGIN |
---|
206 | |
---|
207 | table_list := ''''; |
---|
208 | -- public semasinda bulunan tum tablolar, bizim tablolarimiz |
---|
209 | |
---|
210 | FOR mtable IN select * from pg_tables where schemaname = ''public'' LOOP |
---|
211 | IF position(''databasechangelog'' in mtable.tablename)>0 THEN CONTINUE; END IF; |
---|
212 | table_list := table_list || quote_ident(mtable.tablename) || '', ''; |
---|
213 | END LOOP; |
---|
214 | |
---|
215 | table_list := substring(table_list from 0 for length(table_list)-1); |
---|
216 | |
---|
217 | EXECUTE ''TRUNCATE TABLE '' || table_list; |
---|
218 | |
---|
219 | RETURN table_list; |
---|
220 | END;'; |
---|
221 | ]]> |
---|
222 | </createProcedure> |
---|
223 | <rollback/> |
---|
224 | </changeSet> |
---|
225 | <!-- << INFRASTRUCTURE SCHEMA --> |
---|
226 | <!-- WORKSPACE SCHEMA >> --> |
---|
227 | <changeSet author="fmguler" id="21"> |
---|
228 | <createTable schemaName="public" tableName="workspace_file"> |
---|
229 | <column autoIncrement="true" name="no" type="serial"> |
---|
230 | <constraints nullable="false" primaryKey="true" primaryKeyName="workspace_file_pkey"/> |
---|
231 | </column> |
---|
232 | <column name="user_no" type="int4"/> |
---|
233 | <column name="file_path" type="VARCHAR(10000)"/> |
---|
234 | <column name="file_summary" type="TEXT(2147483647)"/> |
---|
235 | <column name="status" type="int4"/> |
---|
236 | <column name="creation_date" type="TIMESTAMP WITHOUT TIME ZONE"/> |
---|
237 | <column name="file_extension" type="VARCHAR(1024)"/> |
---|
238 | <column defaultValueBoolean="false" name="temporary" type="bool"> |
---|
239 | <constraints nullable="false"/> |
---|
240 | </column> |
---|
241 | </createTable> |
---|
242 | </changeSet> |
---|
243 | <!-- << WORKSPACE SCHEMA --> |
---|
244 | <changeSet author="fmguler" id="22"> |
---|
245 | <tagDatabase tag="21"/> |
---|
246 | </changeSet> |
---|
247 | <!-- DOX SCHEMA >> --> |
---|
248 | <changeSet author="fmguler" id="23"> |
---|
249 | <createTable schemaName="public" tableName="dox_message"> |
---|
250 | <column autoIncrement="true" name="no" type="serial"> |
---|
251 | <constraints nullable="false" primaryKey="true" primaryKeyName="dox_message_pkey"/> |
---|
252 | </column> |
---|
253 | <column name="type" type="int4"/> |
---|
254 | <column name="subject" type="VARCHAR(10000)"> |
---|
255 | <constraints nullable="false"/> |
---|
256 | </column> |
---|
257 | <column name="content" type="TEXT(2147483647)"> |
---|
258 | <constraints nullable="false"/> |
---|
259 | </column> |
---|
260 | <column name="sender" type="VARCHAR(1024)"> |
---|
261 | <constraints nullable="false"/> |
---|
262 | </column> |
---|
263 | <column name="date" type="TIMESTAMP WITHOUT TIME ZONE"/> |
---|
264 | <column defaultValueNumeric="0" name="options" type="int4"> |
---|
265 | <constraints nullable="false"/> |
---|
266 | </column> |
---|
267 | <column defaultValueNumeric="0" name="status" type="int4"> |
---|
268 | <constraints nullable="false"/> |
---|
269 | </column> |
---|
270 | </createTable> |
---|
271 | </changeSet> |
---|
272 | <changeSet author="fmguler" id="24"> |
---|
273 | <createTable schemaName="public" tableName="dox_message_attribute"> |
---|
274 | <column autoIncrement="true" name="no" type="serial"> |
---|
275 | <constraints nullable="false" primaryKey="true" primaryKeyName="dox_message_attribute_pkey"/> |
---|
276 | </column> |
---|
277 | <column name="message_no" type="int4"> |
---|
278 | <constraints nullable="false"/> |
---|
279 | </column> |
---|
280 | <column name="type" type="VARCHAR(1024)"> |
---|
281 | <constraints nullable="false"/> |
---|
282 | </column> |
---|
283 | <column name="attribute" type="VARCHAR(1024)"> |
---|
284 | <constraints nullable="false"/> |
---|
285 | </column> |
---|
286 | <column name="value" type="TEXT(2147483647)"> |
---|
287 | <constraints nullable="false"/> |
---|
288 | </column> |
---|
289 | <column defaultValueNumeric="0" name="order" type="int4"> |
---|
290 | <constraints nullable="false"/> |
---|
291 | </column> |
---|
292 | </createTable> |
---|
293 | </changeSet> |
---|
294 | <changeSet author="fmguler" id="25"> |
---|
295 | <createTable schemaName="public" tableName="dox_message_attachment"> |
---|
296 | <column autoIncrement="true" name="no" type="serial"> |
---|
297 | <constraints nullable="false" primaryKey="true" primaryKeyName="dox_message_attachment_pkey"/> |
---|
298 | </column> |
---|
299 | <column name="message_no" type="int4"> |
---|
300 | <constraints nullable="false"/> |
---|
301 | </column> |
---|
302 | <column name="content_no" type="int4"> |
---|
303 | <constraints nullable="false"/> |
---|
304 | </column> |
---|
305 | <column name="content_type" type="VARCHAR(1000)"> |
---|
306 | <constraints nullable="false"/> |
---|
307 | </column> |
---|
308 | <column name="name" type="VARCHAR(10000)"> |
---|
309 | <constraints nullable="false"/> |
---|
310 | </column> |
---|
311 | <column name="reference" type="VARCHAR(1000)"> |
---|
312 | <constraints nullable="false"/> |
---|
313 | </column> |
---|
314 | <column defaultValueNumeric="0" name="flags" type="int4"> |
---|
315 | <constraints nullable="false"/> |
---|
316 | </column> |
---|
317 | </createTable> |
---|
318 | </changeSet> |
---|
319 | <changeSet author="fmguler" id="26"> |
---|
320 | <createTable schemaName="public" tableName="dox_content"> |
---|
321 | <column autoIncrement="true" name="no" type="serial"> |
---|
322 | <constraints nullable="false" primaryKey="true" primaryKeyName="dox_attachment_content_pkey"/> |
---|
323 | </column> |
---|
324 | <column name="path" type="VARCHAR(10000)"> |
---|
325 | <constraints nullable="false"/> |
---|
326 | </column> |
---|
327 | <column name="hash" type="VARCHAR(1024)"/> |
---|
328 | </createTable> |
---|
329 | </changeSet> |
---|
330 | <changeSet author="fmguler" id="27"> |
---|
331 | <addForeignKeyConstraint baseColumnNames="message_no" baseTableName="dox_message_attribute" baseTableSchemaName="public" constraintName="dox_message_attribute_message_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_message" referencedTableSchemaName="public"/> |
---|
332 | </changeSet> |
---|
333 | <changeSet author="fmguler" id="28"> |
---|
334 | <addForeignKeyConstraint baseColumnNames="message_no" baseTableName="dox_message_attachment" baseTableSchemaName="public" constraintName="dox_message_attachment_message_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_message" referencedTableSchemaName="public"/> |
---|
335 | </changeSet> |
---|
336 | <changeSet author="fmguler" id="29"> |
---|
337 | <addForeignKeyConstraint baseColumnNames="content_no" baseTableName="dox_message_attachment" baseTableSchemaName="public" constraintName="dox_message_attachment_content_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_content" referencedTableSchemaName="public"/> |
---|
338 | </changeSet> |
---|
339 | <changeSet author="fmguler" id="30"> |
---|
340 | <tagDatabase tag="29"/> |
---|
341 | </changeSet> |
---|
342 | <!-- DOX SCHEMA (TRANSACTION) >> --> |
---|
343 | <changeSet author="fmguler" id="31"> |
---|
344 | <createTable schemaName="public" tableName="dox_domain"> |
---|
345 | <column autoIncrement="true" name="no" type="serial"> |
---|
346 | <constraints nullable="false" primaryKey="true" primaryKeyName="dox_domain_pkey"/> |
---|
347 | </column> |
---|
348 | <column name="domain" type="VARCHAR(1024)"/> |
---|
349 | <column name="address" type="VARCHAR(2048)"/> |
---|
350 | <column name="client_certificate" type="TEXT(2147483647)"/> |
---|
351 | <column name="server_certificate" type="TEXT(2147483647)"/> |
---|
352 | <column defaultValueBoolean="false" name="can_relay" type="bool"> |
---|
353 | <constraints nullable="false"/> |
---|
354 | </column> |
---|
355 | <column defaultValueNumeric="0" name="protocol" type="int4"> |
---|
356 | <constraints nullable="false"/> |
---|
357 | </column> |
---|
358 | </createTable> |
---|
359 | </changeSet> |
---|
360 | <changeSet author="fmguler" id="32"> |
---|
361 | <createTable schemaName="public" tableName="dox_transaction_log"> |
---|
362 | <column autoIncrement="true" name="no" type="serial"> |
---|
363 | <constraints nullable="false" primaryKey="true" primaryKeyName="dox_transaction_log_pkey"/> |
---|
364 | </column> |
---|
365 | <column name="message_no" type="int4"/> |
---|
366 | <column name="sender" type="VARCHAR(1024)"> |
---|
367 | <constraints nullable="false"/> |
---|
368 | </column> |
---|
369 | <column name="recipient" type="VARCHAR(1024)"> |
---|
370 | <constraints nullable="false"/> |
---|
371 | </column> |
---|
372 | <column defaultValueNumeric="0" name="sender_domain_no" type="int4"> |
---|
373 | <constraints nullable="false"/> |
---|
374 | </column> |
---|
375 | <column defaultValueNumeric="0" name="recipient_domain_no" type="int4"> |
---|
376 | <constraints nullable="false"/> |
---|
377 | </column> |
---|
378 | <column defaultValueBoolean="false" name="relay" type="bool"> |
---|
379 | <constraints nullable="false"/> |
---|
380 | </column> |
---|
381 | <column defaultValueDate="now()" name="date" type="TIMESTAMP WITHOUT TIME ZONE"> |
---|
382 | <constraints nullable="false"/> |
---|
383 | </column> |
---|
384 | <column defaultValueNumeric="0" name="protocol" type="int4"> |
---|
385 | <constraints nullable="false"/> |
---|
386 | </column> |
---|
387 | <column defaultValueNumeric="0" name="status" type="int4"> |
---|
388 | <constraints nullable="false"/> |
---|
389 | </column> |
---|
390 | <column name="details" type="TEXT(2147483647)"/> |
---|
391 | </createTable> |
---|
392 | </changeSet> |
---|
393 | <changeSet author="fmguler" id="33"> |
---|
394 | <createTable schemaName="public" tableName="dox_user_message"> |
---|
395 | <column autoIncrement="true" name="no" type="serial"> |
---|
396 | <constraints nullable="false" primaryKey="true" primaryKeyName="dox_user_message_pkey"/> |
---|
397 | </column> |
---|
398 | <column name="user_no" type="int4"> |
---|
399 | <constraints nullable="false"/> |
---|
400 | </column> |
---|
401 | <column name="message_no" type="int4"> |
---|
402 | <constraints nullable="false"/> |
---|
403 | </column> |
---|
404 | <column defaultValueNumeric="0" name="folder" type="int4"> |
---|
405 | <constraints nullable="false"/> |
---|
406 | </column> |
---|
407 | <column name="transaction_log_no" type="int4"/> |
---|
408 | </createTable> |
---|
409 | </changeSet> |
---|
410 | <changeSet author="fmguler" id="34"> |
---|
411 | <addForeignKeyConstraint baseColumnNames="sender_domain_no" baseTableName="dox_transaction_log" baseTableSchemaName="public" constraintName="dox_transaction_log_sender_domain_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_domain" referencedTableSchemaName="public"/> |
---|
412 | </changeSet> |
---|
413 | <changeSet author="fmguler" id="35"> |
---|
414 | <addForeignKeyConstraint baseColumnNames="recipient_domain_no" baseTableName="dox_transaction_log" baseTableSchemaName="public" constraintName="dox_transaction_log_recipient_domain_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_domain" referencedTableSchemaName="public"/> |
---|
415 | </changeSet> |
---|
416 | <changeSet author="fmguler" id="36"> |
---|
417 | <addForeignKeyConstraint baseColumnNames="message_no" baseTableName="dox_transaction_log" baseTableSchemaName="public" constraintName="dox_transaction_log_message_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_message" referencedTableSchemaName="public"/> |
---|
418 | </changeSet> |
---|
419 | <changeSet author="fmguler" id="37"> |
---|
420 | <addForeignKeyConstraint baseColumnNames="message_no" baseTableName="dox_user_message" baseTableSchemaName="public" constraintName="dox_user_message_message_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_message" referencedTableSchemaName="public"/> |
---|
421 | </changeSet> |
---|
422 | <changeSet author="fmguler" id="38"> |
---|
423 | <addForeignKeyConstraint baseColumnNames="transaction_log_no" baseTableName="dox_user_message" baseTableSchemaName="public" constraintName="dox_user_message_transaction_log_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="SET NULL" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_transaction_log" referencedTableSchemaName="public"/> |
---|
424 | </changeSet> |
---|
425 | <changeSet author="fmguler" id="39"> |
---|
426 | <tagDatabase tag="38"/> |
---|
427 | </changeSet> |
---|
428 | <!-- DOX SCHEMA (UPDATE 1) --> |
---|
429 | <changeSet author="fmguler" id="40"> |
---|
430 | <addColumn tableName="dox_message_attachment" schemaName="public"> |
---|
431 | <column name="content_length" type="int4" defaultValueNumeric="0"/> |
---|
432 | </addColumn> |
---|
433 | <comment>to keep track of attachment size, and tell to the browser while downloading</comment> |
---|
434 | </changeSet> |
---|
435 | <changeSet author="fmguler" id="41"> |
---|
436 | <comment> |
---|
437 | change on delete cascade to on delete restrict of some foreign key constraints, since referencing tables does not belong to referenced tables |
---|
438 | e.g. Msg. attachment does not belong to content, if a msg attch. exists, referenced content cannot be deleted. |
---|
439 | </comment> |
---|
440 | <dropForeignKeyConstraint baseTableName="dox_message_attachment" baseTableSchemaName="public" constraintName="dox_message_attachment_content_no_fkey"/> |
---|
441 | <rollback changeSetId="29" changeSetAuthor="fmguler" /> |
---|
442 | </changeSet> |
---|
443 | <changeSet author="fmguler" id="42"> |
---|
444 | <addForeignKeyConstraint baseTableName="dox_message_attachment" baseTableSchemaName="public" baseColumnNames="content_no" constraintName="dox_message_attachment_content_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_content" referencedTableSchemaName="public"/> |
---|
445 | </changeSet> |
---|
446 | <changeSet author="fmguler" id="43"> |
---|
447 | <dropForeignKeyConstraint baseTableName="dox_transaction_log" baseTableSchemaName="public" constraintName="dox_transaction_log_recipient_domain_no_fkey"/> |
---|
448 | <rollback changeSetId="35" changeSetAuthor="fmguler" /> |
---|
449 | </changeSet> |
---|
450 | <changeSet author="fmguler" id="44"> |
---|
451 | <addForeignKeyConstraint baseColumnNames="recipient_domain_no" baseTableName="dox_transaction_log" baseTableSchemaName="public" constraintName="dox_transaction_log_recipient_domain_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_domain" referencedTableSchemaName="public"/> |
---|
452 | </changeSet> |
---|
453 | <changeSet author="fmguler" id="45"> |
---|
454 | <dropForeignKeyConstraint baseTableName="dox_transaction_log" baseTableSchemaName="public" constraintName="dox_transaction_log_sender_domain_no_fkey"/> |
---|
455 | <rollback changeSetId="34" changeSetAuthor="fmguler" /> |
---|
456 | </changeSet> |
---|
457 | <changeSet author="fmguler" id="46"> |
---|
458 | <addForeignKeyConstraint baseColumnNames="sender_domain_no" baseTableName="dox_transaction_log" baseTableSchemaName="public" constraintName="dox_transaction_log_sender_domain_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_domain" referencedTableSchemaName="public"/> |
---|
459 | </changeSet> |
---|
460 | <changeSet author="fmguler" id="47"> |
---|
461 | <dropForeignKeyConstraint baseTableName="dox_user_message" baseTableSchemaName="public" constraintName="dox_user_message_transaction_log_no_fkey"/> |
---|
462 | <rollback changeSetId="38" changeSetAuthor="fmguler" /> |
---|
463 | </changeSet> |
---|
464 | <changeSet author="fmguler" id="48"> |
---|
465 | <addForeignKeyConstraint baseColumnNames="transaction_log_no" baseTableName="dox_user_message" baseTableSchemaName="public" constraintName="dox_user_message_transaction_log_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_transaction_log" referencedTableSchemaName="public"/> |
---|
466 | </changeSet> |
---|
467 | <changeSet author="fmguler" id="49"> |
---|
468 | <dropForeignKeyConstraint baseTableName="dox_user_message" baseTableSchemaName="public" constraintName="dox_user_message_message_no_fkey"/> |
---|
469 | <rollback changeSetId="37" changeSetAuthor="fmguler" /> |
---|
470 | </changeSet> |
---|
471 | <changeSet author="fmguler" id="50"> |
---|
472 | <addForeignKeyConstraint baseColumnNames="message_no" baseTableName="dox_user_message" baseTableSchemaName="public" constraintName="dox_user_message_message_no_fkey" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="CASCADE" referencedColumnNames="no" referencedTableName="dox_message" referencedTableSchemaName="public"/> |
---|
473 | </changeSet> |
---|
474 | <changeSet author="fmguler" id="51"> |
---|
475 | <tagDatabase tag="50"/> |
---|
476 | </changeSet> |
---|
477 | <!-- << DOX SCHEMA --> |
---|
478 | </databaseChangeLog> |
---|