blob: c4c911ad18d734f23d5a665568d5b8ef016ab39f [file] [log] [blame]
Matthias Andreas Benkard80fc4312020-06-13 16:59:04 +02001<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2<databaseChangeLog
3 xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4 xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5 xmlns:pro="http://www.liquibase.org/xml/ns/pro"
6 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7 xsi:schemaLocation="
8 http://www.liquibase.org/xml/ns/dbchangelog-ext
9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
10 http://www.liquibase.org/xml/ns/pro
11 http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.9.xsd
12 http://www.liquibase.org/xml/ns/dbchangelog
13 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">
14
15 <changeSet author="mulk (generated)" id="1592058325319-1">
16 <createTable tableName="article_types">
17 <column autoIncrement="true" name="id" type="INTEGER">
18 <constraints nullable="false" primaryKey="true" primaryKeyName="article_types_pkey"/>
19 </column>
20 <column name="name" type="VARCHAR"/>
21 <column name="page_template" type="VARCHAR"/>
22 </createTable>
23 </changeSet>
24
25 <changeSet author="mulk (generated)" id="1592058325319-2">
26 <createTable tableName="cached_pages">
27 <column name="alias" type="VARCHAR">
28 <constraints nullable="false" primaryKey="true" primaryKeyName="cached_pages_pkey"/>
29 </column>
30 <column name="characteristic_hash" type="INTEGER">
31 <constraints nullable="false" primaryKey="true" primaryKeyName="cached_pages_pkey"/>
32 </column>
33 <column defaultValueComputed="now()" name="date" type="TIMESTAMP WITHOUT TIME ZONE">
34 <constraints nullable="false"/>
35 </column>
36 <column name="content" type="VARCHAR">
37 <constraints nullable="false"/>
38 </column>
39 </createTable>
40 </changeSet>
41
42 <changeSet author="mulk (generated)" id="1592058325319-3">
43 <createTable tableName="used_transaction_keys">
44 <column name="key" type="BIGINT">
45 <constraints nullable="false" primaryKey="true"
46 primaryKeyName="used_transaction_keys_pkey"/>
47 </column>
48 </createTable>
49 </changeSet>
50
51 <changeSet author="mulk (generated)" id="1592058325319-4">
52 <createTable tableName="users">
53 <column autoIncrement="true" name="id" type="INTEGER">
54 <constraints nullable="false" primaryKey="true" primaryKeyName="users_pkey"/>
55 </column>
56 <column name="name" type="VARCHAR"/>
57 <column name="status" type="VARCHAR">
58 <constraints nullable="false"/>
59 </column>
60 <column name="email" type="VARCHAR"/>
61 <column name="website" type="VARCHAR"/>
62 </createTable>
63 </changeSet>
64
65 <changeSet author="mulk (generated)" id="1592058325319-5">
66 <createTable tableName="openids">
67 <column name="user" type="INTEGER">
68 <constraints nullable="false" primaryKey="true" primaryKeyName="openids_pkey"/>
69 </column>
70 <column name="openid" type="VARCHAR">
71 <constraints nullable="false" primaryKey="true" primaryKeyName="openids_pkey"/>
72 </column>
73 </createTable>
74 </changeSet>
75
76 <changeSet author="mulk (generated)" id="1592058325319-6">
77 <createTable tableName="passwords">
78 <column name="user" type="INTEGER">
79 <constraints nullable="false" primaryKey="true" primaryKeyName="passwords_pkey"/>
80 </column>
81 <column name="password" type="VARCHAR">
82 <constraints nullable="false" primaryKey="true" primaryKeyName="passwords_pkey"/>
83 </column>
84 </createTable>
85 </changeSet>
86
87 <changeSet author="mulk (generated)" id="1592058325319-7">
88 <createTable tableName="articles">
89 <column autoIncrement="true" name="id" type="INTEGER">
90 <constraints nullable="false" primaryKey="true" primaryKeyName="articles_pkey"/>
91 </column>
92 <column name="type" type="INTEGER">
93 <constraints nullable="false"/>
94 </column>
95 </createTable>
96 </changeSet>
97
98 <changeSet author="mulk (generated)" id="1592058325319-8">
99 <createTable tableName="journal_pingback">
100 <column autoIncrement="true" name="id" type="INTEGER">
101 <constraints nullable="false" primaryKey="true" primaryKeyName="journal_pingbackpk"/>
102 </column>
103 <column name="entry_id" type="INTEGER">
104 <constraints nullable="false"/>
105 </column>
106 <column name="uuid" type="CHAR(36)">
107 <constraints nullable="false"/>
108 </column>
109 <column name="date" type="BIGINT">
110 <constraints nullable="false"/>
111 </column>
112 <column name="url" type="TEXT"/>
113 <column name="spam_p" type="BOOLEAN"/>
114 <column name="submitter_ip" type="TEXT">
115 <constraints nullable="false"/>
116 </column>
117 <column name="submitter_user_agent" type="TEXT">
118 <constraints nullable="false"/>
119 </column>
120 </createTable>
121 </changeSet>
122
123 <changeSet author="mulk (generated)" id="1592058325319-9">
124 <createTable tableName="article_revisions">
125 <column autoIncrement="true" name="id" type="INTEGER">
126 <constraints nullable="false" primaryKey="true" primaryKeyName="article_revisions_pkey"/>
127 </column>
128 <column name="article" type="INTEGER">
129 <constraints nullable="false"/>
130 </column>
131 <column defaultValueComputed="now()" name="date" type="TIMESTAMP WITHOUT TIME ZONE"/>
132 <column name="title" type="VARCHAR">
133 <constraints nullable="false"/>
134 </column>
135 <column name="content" type="VARCHAR">
136 <constraints nullable="false"/>
137 </column>
138 <column name="author" type="INTEGER"/>
139 <column name="format" type="VARCHAR">
140 <constraints nullable="false"/>
141 </column>
142 <column name="status" type="VARCHAR">
143 <constraints nullable="false"/>
144 </column>
145 <column name="global_id" type="VARCHAR"/>
146 </createTable>
147 </changeSet>
148
149 <changeSet author="mulk (generated)" id="1592058325319-10">
150 <createTable tableName="article_revision_parenthood">
151 <column name="parent" type="INTEGER">
152 <constraints nullable="false" primaryKey="true"
153 primaryKeyName="article_revision_parenthood_pkey"/>
154 </column>
155 <column name="child" type="INTEGER">
156 <constraints nullable="false" primaryKey="true"
157 primaryKeyName="article_revision_parenthood_pkey"/>
158 </column>
159 </createTable>
160 </changeSet>
161
162 <changeSet author="mulk (generated)" id="1592058325319-11">
163 <createTable tableName="journal_comment">
164 <column autoIncrement="true" name="id" type="INTEGER">
165 <constraints nullable="false" primaryKey="true" primaryKeyName="JOURNAL_COMMENTPK"/>
166 </column>
167 <column name="entry_id" type="INTEGER">
168 <constraints nullable="false"/>
169 </column>
170 <column name="uuid" type="CHAR(36)">
171 <constraints nullable="false"/>
172 </column>
173 <column name="date" type="BIGINT">
174 <constraints nullable="false"/>
175 </column>
176 <column name="body" type="TEXT">
177 <constraints nullable="false"/>
178 </column>
179 <column name="author" type="TEXT"/>
180 <column name="email" type="TEXT"/>
181 <column name="website" type="TEXT"/>
182 <column name="spam_p" type="BOOLEAN"/>
183 <column defaultValue="0.0.0.0" name="submitter_ip" type="TEXT">
184 <constraints nullable="false"/>
185 </column>
186 <column name="submitter_user_agent" type="TEXT">
187 <constraints nullable="false"/>
188 </column>
189 </createTable>
190 </changeSet>
191
192 <changeSet author="mulk (generated)" id="1592058325319-12">
193 <createTable tableName="user_permissions">
194 <column name="user" type="INTEGER">
195 <constraints nullable="false" primaryKey="true" primaryKeyName="user_permissions_pkey"/>
196 </column>
197 <column name="permission" type="VARCHAR">
198 <constraints nullable="false" primaryKey="true" primaryKeyName="user_permissions_pkey"/>
199 </column>
200 <column name="status" type="BOOLEAN"/>
201 </createTable>
202 </changeSet>
203
204 <changeSet author="mulk (generated)" id="1592058325319-13">
205 <createTable tableName="journal_category">
206 <column autoIncrement="true" name="id" type="INTEGER">
207 <constraints nullable="false" primaryKey="true" primaryKeyName="journal_categorypk"/>
208 </column>
209 <column name="uuid" type="CHAR(36)">
210 <constraints nullable="false"/>
211 </column>
212 </createTable>
213 </changeSet>
214
215 <changeSet author="mulk (generated)" id="1592058325319-14">
216 <createTable tableName="journals">
217 <column name="id" type="INTEGER">
218 <constraints nullable="false" primaryKey="true" primaryKeyName="journals_pkey"/>
219 </column>
220 <column name="path_prefix" type="VARCHAR"/>
221 </createTable>
222 </changeSet>
223
224 <changeSet author="mulk (generated)" id="1592058325319-15">
225 <createTable tableName="category_inclusions">
226 <column name="category" type="INTEGER">
227 <constraints nullable="false" primaryKey="true" primaryKeyName="category_inclusions_pkey"/>
228 </column>
229 <column name="supercategory" type="INTEGER">
230 <constraints nullable="false" primaryKey="true" primaryKeyName="category_inclusions_pkey"/>
231 </column>
232 </createTable>
233 </changeSet>
234
235 <changeSet author="mulk (generated)" id="1592058325319-16">
236 <createTable tableName="journal_entry">
237 <column autoIncrement="true" name="id" type="INTEGER">
238 <constraints nullable="false" primaryKey="true" primaryKeyName="journal_entrypk"/>
239 </column>
240 <column name="uuid" type="CHAR(36)">
241 <constraints nullable="false"/>
242 </column>
243 <column name="title" type="TEXT">
244 <constraints nullable="false"/>
245 </column>
246 <column name="date" type="BIGINT">
247 <constraints nullable="false"/>
248 </column>
249 <column name="last_modification" type="BIGINT"/>
250 <column name="body" type="TEXT">
251 <constraints nullable="false"/>
252 </column>
253 <column defaultValue="markdown" name="type" type="TEXT">
254 <constraints nullable="false"/>
255 </column>
256 </createTable>
257 </changeSet>
258
259 <changeSet author="mulk (generated)" id="1592058325319-17">
260 <createTable tableName="journal_trackback">
261 <column autoIncrement="true" name="id" type="INTEGER">
262 <constraints nullable="false" primaryKey="true" primaryKeyName="journal_trackbackpk"/>
263 </column>
264 <column name="entry_id" type="INTEGER">
265 <constraints nullable="false"/>
266 </column>
267 <column name="uuid" type="CHAR(36)">
268 <constraints nullable="false"/>
269 </column>
270 <column name="date" type="BIGINT">
271 <constraints nullable="false"/>
272 </column>
273 <column name="excerpt" type="TEXT">
274 <constraints nullable="false"/>
275 </column>
276 <column name="title" type="TEXT"/>
277 <column name="blog_name" type="TEXT"/>
278 <column name="url" type="TEXT"/>
279 <column name="spam_p" type="BOOLEAN"/>
280 <column name="submitter_ip" type="TEXT">
281 <constraints nullable="false"/>
282 </column>
283 <column name="submitter_user_agent" type="TEXT">
284 <constraints nullable="false"/>
285 </column>
286 </createTable>
287 </changeSet>
288
289 <changeSet author="mulk (generated)" id="1592058325319-18">
290 <createTable tableName="user_settings">
291 <column name="user" type="INTEGER">
292 <constraints nullable="false" primaryKey="true" primaryKeyName="user_settings_pkey"/>
293 </column>
294 <column name="setting" type="VARCHAR">
295 <constraints nullable="false" primaryKey="true" primaryKeyName="user_settings_pkey"/>
296 </column>
297 <column name="value" type="VARCHAR"/>
298 </createTable>
299 </changeSet>
300
301 <changeSet author="mulk (generated)" id="1592058325319-19">
302 <createTable tableName="article_category_memberships">
303 <column name="article" type="INTEGER">
304 <constraints nullable="false" primaryKey="true"
305 primaryKeyName="article_category_memberships_pkey"/>
306 </column>
307 <column name="category" type="VARCHAR">
308 <constraints nullable="false" primaryKey="true"
309 primaryKeyName="article_category_memberships_pkey"/>
310 </column>
311 </createTable>
312 </changeSet>
313
314 <changeSet author="mulk (generated)" id="1592058325319-20">
315 <createTable tableName="categories">
316 <column autoIncrement="true" name="id" type="INTEGER">
317 <constraints nullable="false" primaryKey="true" primaryKeyName="categories_pkey"/>
318 </column>
319 <column name="name" type="VARCHAR">
320 <constraints nullable="false"/>
321 </column>
322 </createTable>
323 </changeSet>
324
325 <changeSet author="mulk (generated)" id="1592058325319-21">
326 <createTable tableName="journal_entries">
327 <column name="journal" type="INTEGER">
328 <constraints nullable="false" primaryKey="true" primaryKeyName="journal_entries_pkey"/>
329 </column>
330 <column name="index" type="INTEGER">
331 <constraints nullable="false" primaryKey="true" primaryKeyName="journal_entries_pkey"/>
332 </column>
333 <column name="article" type="INTEGER">
334 <constraints nullable="false"/>
335 </column>
336 </createTable>
337 </changeSet>
338
339 <changeSet author="mulk (generated)" id="1592058325319-22">
340 <createTable tableName="article_aliases">
341 <column name="alias" type="VARCHAR">
342 <constraints nullable="false" primaryKey="true" primaryKeyName="article_aliases_pkey"/>
343 </column>
344 <column name="article" type="INTEGER">
345 <constraints nullable="false"/>
346 </column>
347 </createTable>
348 </changeSet>
349
350 <changeSet author="mulk (generated)" id="1592058325319-23">
351 <createTable tableName="comment_revisions">
352 <column autoIncrement="true" name="id" type="INTEGER">
353 <constraints nullable="false" primaryKey="true" primaryKeyName="comment_revisions_pkey"/>
354 </column>
355 <column name="comment" type="INTEGER">
356 <constraints nullable="false"/>
357 </column>
358 <column defaultValueComputed="now()" name="date" type="TIMESTAMP WITHOUT TIME ZONE"/>
359 <column name="content" type="VARCHAR">
360 <constraints nullable="false"/>
361 </column>
362 <column name="author" type="INTEGER"/>
363 <column name="format" type="VARCHAR">
364 <constraints nullable="false"/>
365 </column>
366 <column name="status" type="VARCHAR">
367 <constraints nullable="false"/>
368 </column>
369 <column name="article_revision" type="INTEGER"/>
370 <column name="submitter_ip" type="INET"/>
371 <column name="submitter_user_agent" type="VARCHAR"/>
372 </createTable>
373 </changeSet>
374
375 <changeSet author="mulk (generated)" id="1592058325319-24">
376 <createTable tableName="article_revision_characteristics">
377 <column name="revision" type="INTEGER">
378 <constraints nullable="false"/>
379 </column>
380 <column name="characteristic" type="VARCHAR">
381 <constraints nullable="false"/>
382 </column>
383 <column name="value" type="VARCHAR"/>
384 </createTable>
385 </changeSet>
386
387 <changeSet author="mulk (generated)" id="1592058325319-25">
388 <createTable tableName="comments">
389 <column autoIncrement="true" name="id" type="INTEGER">
390 <constraints nullable="false" primaryKey="true" primaryKeyName="comments_pkey"/>
391 </column>
392 <column name="article" type="INTEGER">
393 <constraints nullable="false"/>
394 </column>
395 <column name="global_id" type="VARCHAR"/>
396 </createTable>
397 </changeSet>
398
399 <changeSet author="mulk (generated)" id="1592058325319-26">
400 <createTable tableName="login_certificates">
401 <column name="user" type="INTEGER">
402 <constraints nullable="false" primaryKey="true" primaryKeyName="login_certificates_pkey"/>
403 </column>
404 <column name="certificate" type="BYTEA">
405 <constraints nullable="false" primaryKey="true" primaryKeyName="login_certificates_pkey"/>
406 </column>
407 </createTable>
408 </changeSet>
409
410 <changeSet author="mulk (generated)" id="1592058325319-27">
411 <addForeignKeyConstraint baseColumnNames="type" baseTableName="articles"
412 constraintName="articles_type_fkey" deferrable="false" initiallyDeferred="false"
413 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
414 referencedTableName="article_types" validate="true"/>
415 </changeSet>
416
417 <changeSet author="mulk (generated)" id="1592058325319-28">
418 <addForeignKeyConstraint baseColumnNames="user" baseTableName="openids"
419 constraintName="openids_user_fkey" deferrable="false" initiallyDeferred="false"
420 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
421 referencedTableName="users" validate="true"/>
422 </changeSet>
423
424 <changeSet author="mulk (generated)" id="1592058325319-29">
425 <addForeignKeyConstraint baseColumnNames="user" baseTableName="passwords"
426 constraintName="passwords_user_fkey" deferrable="false" initiallyDeferred="false"
427 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
428 referencedTableName="users" validate="true"/>
429 </changeSet>
430
431 <changeSet author="mulk (generated)" id="1592058325319-30">
432 <createView fullDefinition="false" viewName="article_comment_counts">SELECT a.id AS article,
433 count(c.*) AS comment_count
434 FROM (articles a
435 LEFT JOIN comments c ON (((c.article = a.id) AND (EXISTS ( SELECT comment_revisions.id,
436 comment_revisions.comment,
437 comment_revisions.date,
438 comment_revisions.content,
439 comment_revisions.author,
440 comment_revisions.format,
441 comment_revisions.status,
442 comment_revisions.article_revision,
443 comment_revisions.submitter_ip,
444 comment_revisions.submitter_user_agent
445 FROM comment_revisions
446 WHERE ((comment_revisions.comment = c.id) AND ((comment_revisions.status)::text = ANY
447 (ARRAY[('approved'::character varying)::text, ('trusted'::character varying)::text]))))))))
448 GROUP BY a.id;
449 </createView>
450 </changeSet>
451
452 <changeSet author="mulk (generated)" id="1592058325319-31">
453 <addForeignKeyConstraint baseColumnNames="article" baseTableName="comments"
454 constraintName="comments_article_fkey" deferrable="false" initiallyDeferred="false"
455 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
456 referencedTableName="articles" validate="true"/>
457 </changeSet>
458
459 <changeSet author="mulk (generated)" id="1592058325319-32">
460 <addForeignKeyConstraint baseColumnNames="article" baseTableName="journal_entries"
461 constraintName="journal_entries_article_fkey" deferrable="false" initiallyDeferred="false"
462 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
463 referencedTableName="articles" validate="true"/>
464 </changeSet>
465
466 <changeSet author="mulk (generated)" id="1592058325319-33">
467 <createView fullDefinition="false" viewName="article_branch_tips">SELECT
468 article_revisions.article,
469 article_revisions.id AS revision
470 FROM (( SELECT article_revisions_1.id
471 FROM article_revisions article_revisions_1
472 EXCEPT
473 SELECT article_revision_parenthood.parent
474 FROM article_revision_parenthood) branch_tips
475 JOIN article_revisions USING (id));
476 </createView>
477 </changeSet>
478
479 <changeSet author="mulk (generated)" id="1592058325319-34">
480 <createView fullDefinition="false" viewName="article_publishing_dates">SELECT
481 article_revisions.article,
482 min(article_revisions.date) AS publishing_date
483 FROM article_revisions
484 WHERE ((article_revisions.status)::text = ANY (ARRAY[('published'::character varying)::text,
485 ('syndicated'::character varying)::text]))
486 GROUP BY article_revisions.article;
487 </createView>
488 </changeSet>
489
490 <changeSet author="mulk (generated)" id="1592058325319-35">
491 <addForeignKeyConstraint baseColumnNames="article" baseTableName="article_revisions"
492 constraintName="article_revisions_article_fkey" deferrable="false" initiallyDeferred="false"
493 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
494 referencedTableName="articles" validate="true"/>
495 </changeSet>
496
497 <changeSet author="mulk (generated)" id="1592058325319-36">
498 <addForeignKeyConstraint baseColumnNames="author" baseTableName="article_revisions"
499 constraintName="article_revisions_author_fkey" deferrable="false" initiallyDeferred="false"
500 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
501 referencedTableName="users" validate="true"/>
502 </changeSet>
503
504 <changeSet author="mulk (generated)" id="1592058325319-37">
505 <createIndex indexName="article_revisions_english_ts_idx" tableName="article_revisions">
506 <column computed="true"
507 name="((setweight(to_tsvector('english'::regconfig, (title)::text), 'A'::char) || setweight(to_tsvector('english'::regconfig, (content)::text), 'D'::char)))"/>
508 </createIndex>
509 </changeSet>
510
511 <changeSet author="mulk (generated)" id="1592058325319-38">
512 <createIndex indexName="article_revisions_french_ts_idx" tableName="article_revisions">
513 <column computed="true"
514 name="((setweight(to_tsvector('french'::regconfig, (title)::text), 'A'::char) || setweight(to_tsvector('french'::regconfig, (content)::text), 'D'::char)))"/>
515 </createIndex>
516 </changeSet>
517
518 <changeSet author="mulk (generated)" id="1592058325319-39">
519 <createIndex indexName="article_revisions_german_ts_idx" tableName="article_revisions">
520 <column computed="true"
521 name="((setweight(to_tsvector('german'::regconfig, (title)::text), 'A'::char) || setweight(to_tsvector('german'::regconfig, (content)::text), 'D'::char)))"/>
522 </createIndex>
523 </changeSet>
524
525 <changeSet author="mulk (generated)" id="1592058325319-40">
526 <addUniqueConstraint columnNames="global_id" constraintName="article_revisions_global_id_key"
527 tableName="article_revisions"/>
528 </changeSet>
529
530 <changeSet author="mulk (generated)" id="1592058325319-41">
531 <addForeignKeyConstraint baseColumnNames="child" baseTableName="article_revision_parenthood"
532 constraintName="article_revision_parenthood_child_fkey" deferrable="false"
533 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
534 referencedTableName="article_revisions" validate="true"/>
535 </changeSet>
536
537 <changeSet author="mulk (generated)" id="1592058325319-42">
538 <addForeignKeyConstraint baseColumnNames="parent" baseTableName="article_revision_parenthood"
539 constraintName="article_revision_parenthood_parent_fkey" deferrable="false"
540 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
541 referencedTableName="article_revisions" validate="true"/>
542 </changeSet>
543
544 <changeSet author="mulk (generated)" id="1592058325319-43">
545 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_permissions"
546 constraintName="user_permissions_user_fkey" deferrable="false" initiallyDeferred="false"
547 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
548 referencedTableName="users" validate="true"/>
549 </changeSet>
550
551 <changeSet author="mulk (generated)" id="1592058325319-44">
552 <addForeignKeyConstraint baseColumnNames="entry_id" baseTableName="journal_pingback"
553 constraintName="journal_pingback_journal_entryfk" deferrable="false" initiallyDeferred="false"
554 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
555 referencedTableName="journal_entry" validate="true"/>
556 </changeSet>
557
558 <changeSet author="mulk (generated)" id="1592058325319-45">
559 <addForeignKeyConstraint baseColumnNames="entry_id" baseTableName="journal_trackback"
560 constraintName="journal_trackback_journal_entryfk" deferrable="false"
561 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
562 referencedTableName="journal_entry" validate="true"/>
563 </changeSet>
564
565 <changeSet author="mulk (generated)" id="1592058325319-46">
566 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_settings"
567 constraintName="user_settings_user_fkey" deferrable="false" initiallyDeferred="false"
568 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
569 referencedTableName="users" validate="true"/>
570 </changeSet>
571
572 <changeSet author="mulk (generated)" id="1592058325319-47">
573 <addForeignKeyConstraint baseColumnNames="article" baseTableName="article_category_memberships"
574 constraintName="article_category_memberships_article_fkey" deferrable="false"
575 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
576 referencedTableName="articles" validate="true"/>
577 </changeSet>
578
579 <changeSet author="mulk (generated)" id="1592058325319-48">
580 <addForeignKeyConstraint baseColumnNames="category" baseTableName="category_inclusions"
581 constraintName="category_inclusions_category_fkey" deferrable="false"
582 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
583 referencedTableName="categories" validate="true"/>
584 </changeSet>
585
586 <changeSet author="mulk (generated)" id="1592058325319-49">
587 <addForeignKeyConstraint baseColumnNames="supercategory" baseTableName="category_inclusions"
588 constraintName="category_inclusions_supercategory_fkey" deferrable="false"
589 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
590 referencedTableName="categories" validate="true"/>
591 </changeSet>
592
593 <changeSet author="mulk (generated)" id="1592058325319-50">
594 <addForeignKeyConstraint baseColumnNames="journal" baseTableName="journal_entries"
595 constraintName="journal_entries_journal_fkey" deferrable="false" initiallyDeferred="false"
596 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
597 referencedTableName="journals" validate="true"/>
598 </changeSet>
599
600 <changeSet author="mulk (generated)" id="1592058325319-51">
601 <addForeignKeyConstraint baseColumnNames="article" baseTableName="article_aliases"
602 constraintName="article_aliases_article_fkey" deferrable="false" initiallyDeferred="false"
603 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
604 referencedTableName="articles" validate="true"/>
605 </changeSet>
606
607 <changeSet author="mulk (generated)" id="1592058325319-52">
608 <addForeignKeyConstraint baseColumnNames="author" baseTableName="comment_revisions"
609 constraintName="comment_revisions_author_fkey" deferrable="false" initiallyDeferred="false"
610 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
611 referencedTableName="users" validate="true"/>
612 </changeSet>
613
614 <changeSet author="mulk (generated)" id="1592058325319-53">
615 <addForeignKeyConstraint baseColumnNames="revision"
616 baseTableName="article_revision_characteristics"
617 constraintName="article_revision_characteristics_revision_fkey" deferrable="false"
618 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
619 referencedTableName="article_revisions" validate="true"/>
620 </changeSet>
621
622 <changeSet author="mulk (generated)" id="1592058325319-54">
623 <addUniqueConstraint columnNames="revision, characteristic, value"
624 constraintName="article_revision_characteristics_revision_key"
625 tableName="article_revision_characteristics"/>
626 </changeSet>
627
628 <changeSet author="mulk (generated)" id="1592058325319-55">
629 <addForeignKeyConstraint baseColumnNames="user" baseTableName="login_certificates"
630 constraintName="login_certificates_user_fkey" deferrable="false" initiallyDeferred="false"
631 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
632 referencedTableName="users" validate="true"/>
633 </changeSet>
634
635 <changeSet author="mulk (generated)" id="1592058325319-56">
636 <addForeignKeyConstraint baseColumnNames="entry_id" baseTableName="journal_comment"
637 constraintName="journal_comment_journal_entryfk" deferrable="false" initiallyDeferred="false"
638 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
639 referencedTableName="journal_entry" validate="true"/>
640 </changeSet>
641
642 <changeSet author="mulk (generated)" id="1592058325319-57">
643 <addForeignKeyConstraint baseColumnNames="comment" baseTableName="comment_revisions"
644 constraintName="comment_revisions_comment_fkey" deferrable="false" initiallyDeferred="false"
645 onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
646 referencedTableName="comments" validate="true"/>
647 </changeSet>
648
649 <changeSet author="mulk (generated)" id="1592058325319-58">
650 <createSequence cacheSize="1" cycle="false" dataType="bigint" incrementBy="1"
651 maxValue="9223372036854775807" minValue="1" sequenceName="transaction_key_seq"
652 startValue="1"/>
653 </changeSet>
654
655 <changeSet author="mulk (generated)" id="1592059602097-1">
656 <createTable schemaName="benki" tableName="openids">
657 <column name="user" type="INTEGER">
658 <constraints nullable="false"/>
659 </column>
660 <column name="openid" type="VARCHAR">
661 <constraints nullable="false" primaryKey="true" primaryKeyName="openids_pkey"/>
662 </column>
663 </createTable>
664 </changeSet>
665
666 <changeSet author="mulk (generated)" id="1592059602097-2">
667 <createTable schemaName="benki" tableName="lazychat_references">
668 <column name="referrer" type="INTEGER">
669 <constraints nullable="false" primaryKey="true" primaryKeyName="lazychat_references_pkey"/>
670 </column>
671 <column name="referee" type="INTEGER">
672 <constraints nullable="false" primaryKey="true" primaryKeyName="lazychat_references_pkey"/>
673 </column>
674 </createTable>
675 </changeSet>
676
677 <changeSet author="mulk (generated)" id="1592059602097-3">
678 <createTable schemaName="benki" tableName="rsa_keys">
679 <column name="modulus" type="numeric">
680 <constraints nullable="false" primaryKey="true" primaryKeyName="rsa_keys_pkey"/>
681 </column>
682 <column name="exponent" type="numeric">
683 <constraints nullable="false" primaryKey="true" primaryKeyName="rsa_keys_pkey"/>
684 </column>
685 </createTable>
686 </changeSet>
687
688 <changeSet author="mulk (generated)" id="1592059602097-4">
689 <createTable schemaName="benki" tableName="user_jids">
690 <column name="user" type="INTEGER">
691 <constraints nullable="false" primaryKey="true" primaryKeyName="user_jids_pkey"/>
692 </column>
693 <column name="jid" type="VARCHAR">
694 <constraints nullable="false" primaryKey="true" primaryKeyName="user_jids_pkey"/>
695 </column>
696 </createTable>
697 </changeSet>
698
699 <changeSet author="mulk (generated)" id="1592059602097-5">
700 <createTable schemaName="benki" tableName="wiki_page_revisions">
701 <column autoIncrement="true" name="id" type="INTEGER">
702 <constraints nullable="false" primaryKey="true" primaryKeyName="wiki_page_revisions_pkey"/>
703 </column>
704 <column name="page" type="INTEGER">
705 <constraints nullable="false"/>
706 </column>
707 <column defaultValueComputed="now()" name="date" type="TIMESTAMP WITH TIME ZONE"/>
708 <column name="title" type="VARCHAR"/>
709 <column name="content" type="VARCHAR"/>
710 <column name="author" type="INTEGER"/>
711 <column name="format" type="VARCHAR"/>
712 </createTable>
713 </changeSet>
714
715 <changeSet author="mulk (generated)" id="1592059602097-6">
716 <createTable schemaName="benki" tableName="user_roles">
717 <column name="user" type="INTEGER">
718 <constraints nullable="false" primaryKey="true" primaryKeyName="user_roles_pkey"/>
719 </column>
720 <column name="role" type="INTEGER">
721 <constraints nullable="false" primaryKey="true" primaryKeyName="user_roles_pkey"/>
722 </column>
723 </createTable>
724 </changeSet>
725
726 <changeSet author="mulk (generated)" id="1592059602097-7">
727 <createTable schemaName="benki" tableName="post_targets">
728 <column name="message" type="INTEGER">
729 <constraints nullable="false" primaryKey="true" primaryKeyName="lazychat_targets_pkey"/>
730 </column>
731 <column name="target" type="INTEGER">
732 <constraints nullable="false" primaryKey="true" primaryKeyName="lazychat_targets_pkey"/>
733 </column>
734 </createTable>
735 </changeSet>
736
737 <changeSet author="mulk (generated)" id="1592059602097-8">
738 <createTable schemaName="benki" tableName="user_nicknames">
739 <column name="user" type="INTEGER">
740 <constraints nullable="false"/>
741 </column>
742 <column name="nickname" type="VARCHAR">
743 <constraints nullable="false" primaryKey="true" primaryKeyName="user_nicknames_pkey"/>
744 </column>
745 </createTable>
746 </changeSet>
747
748 <changeSet author="mulk (generated)" id="1592059602097-9">
749 <createTable schemaName="benki" tableName="posts">
750 <column autoIncrement="true" name="id" type="INTEGER">
751 <constraints nullable="false" primaryKey="true" primaryKeyName="posts_pkey"/>
752 </column>
753 <column name="owner" type="INTEGER"/>
754 <column defaultValueComputed="now()" name="date" type="TIMESTAMP WITH TIME ZONE"/>
755 </createTable>
756 </changeSet>
757
758 <changeSet author="mulk (generated)" id="1592059602097-10">
759 <createTable schemaName="benki" tableName="users">
760 <column autoIncrement="true" name="id" type="INTEGER">
761 <constraints nullable="false" primaryKey="true" primaryKeyName="users_pkey"/>
762 </column>
763 <column name="first_name" type="VARCHAR"/>
764 <column name="middle_names" type="VARCHAR"/>
765 <column name="last_name" type="VARCHAR"/>
766 <column name="email" type="VARCHAR"/>
767 <column name="website" type="VARCHAR"/>
768 <column name="status" type="VARCHAR"/>
769 <column name="role" type="INTEGER">
770 <constraints nullable="false"/>
771 </column>
772 </createTable>
773 </changeSet>
774
775 <changeSet author="mulk (generated)" id="1592059602097-11">
776 <createTable schemaName="benki" tableName="webids">
777 <column name="user" type="INTEGER">
778 <constraints nullable="false"/>
779 </column>
780 <column name="webid" type="VARCHAR">
781 <constraints nullable="false" primaryKey="true" primaryKeyName="webids_pkey"/>
782 </column>
783 </createTable>
784 </changeSet>
785
786 <changeSet author="mulk (generated)" id="1592059602097-12">
787 <createTable schemaName="benki" tableName="page_keys">
788 <column name="user" type="INTEGER">
789 <constraints nullable="false"/>
790 </column>
791 <column name="page" type="VARCHAR">
792 <constraints nullable="false" primaryKey="true" primaryKeyName="page_keys_pkey"/>
793 </column>
794 <column name="key" type="numeric">
795 <constraints nullable="false" primaryKey="true" primaryKeyName="page_keys_pkey"/>
796 </column>
797 </createTable>
798 </changeSet>
799
800 <changeSet author="mulk (generated)" id="1592059602097-13">
801 <createTable schemaName="benki" tableName="role_tags">
802 <column name="role" type="INTEGER">
803 <constraints nullable="false" primaryKey="true" primaryKeyName="role_tags_pkey"/>
804 </column>
805 <column name="tag" type="VARCHAR">
806 <constraints nullable="false" primaryKey="true" primaryKeyName="role_tags_pkey"/>
807 </column>
808 </createTable>
809 </changeSet>
810
811 <changeSet author="mulk (generated)" id="1592059602097-14">
812 <createTable schemaName="benki" tableName="user_rsa_keys">
813 <column name="user" type="INTEGER">
814 <constraints nullable="false" primaryKey="true" primaryKeyName="user_rsa_keys_pkey"/>
815 </column>
816 <column name="modulus" type="numeric">
817 <constraints nullable="false" primaryKey="true" primaryKeyName="user_rsa_keys_pkey"/>
818 </column>
819 <column name="exponent" type="numeric">
820 <constraints nullable="false" primaryKey="true" primaryKeyName="user_rsa_keys_pkey"/>
821 </column>
822 </createTable>
823 </changeSet>
824
825 <changeSet author="mulk (generated)" id="1592059602097-15">
826 <createTable schemaName="benki" tableName="user_email_addresses">
827 <column name="user" type="INTEGER">
828 <constraints nullable="false"/>
829 </column>
830 <column name="email" type="VARCHAR">
831 <constraints nullable="false" primaryKey="true" primaryKeyName="user_email_addresses_pkey"/>
832 </column>
833 </createTable>
834 </changeSet>
835
836 <changeSet author="mulk (generated)" id="1592059602097-16">
837 <createTable schemaName="benki" tableName="role_subroles">
838 <column name="superrole" type="INTEGER">
839 <constraints nullable="false" primaryKey="true" primaryKeyName="role_subroles_pkey"/>
840 </column>
841 <column name="subrole" type="INTEGER">
842 <constraints nullable="false" primaryKey="true" primaryKeyName="role_subroles_pkey"/>
843 </column>
844 </createTable>
845 </changeSet>
846
847 <changeSet author="mulk (generated)" id="1592059602097-17">
848 <createTable schemaName="benki" tableName="roles">
849 <column autoIncrement="true" name="id" type="INTEGER">
850 <constraints nullable="false" primaryKey="true" primaryKeyName="roles_pkey"/>
851 </column>
852 <column name="name" type="VARCHAR"/>
853 </createTable>
854 </changeSet>
855
856 <changeSet author="mulk (generated)" id="1592059602097-18">
857 <createTable schemaName="benki" tableName="bookmark_tags">
858 <column name="bookmark" type="INTEGER">
859 <constraints nullable="false" primaryKey="true" primaryKeyName="bookmark_tags_pkey"/>
860 </column>
861 <column name="tag" type="VARCHAR">
862 <constraints nullable="false" primaryKey="true" primaryKeyName="bookmark_tags_pkey"/>
863 </column>
864 </createTable>
865 </changeSet>
866
867 <changeSet author="mulk (generated)" id="1592059602097-19">
868 <createTable schemaName="benki" tableName="user_default_target">
869 <column name="user" type="INTEGER">
870 <constraints nullable="false" primaryKey="true" primaryKeyName="user_default_target_pkey"/>
871 </column>
872 <column name="target" type="INTEGER">
873 <constraints nullable="false" primaryKey="true" primaryKeyName="user_default_target_pkey"/>
874 </column>
875 </createTable>
876 </changeSet>
877
878 <changeSet author="mulk (generated)" id="1592059602097-20">
879 <createTable schemaName="benki" tableName="wiki_pages">
880 <column autoIncrement="true" name="id" type="INTEGER">
881 <constraints nullable="false" primaryKey="true" primaryKeyName="wiki_pages_pkey"/>
882 </column>
883 </createTable>
884 </changeSet>
885
886 <changeSet author="mulk (generated)" id="1592059602097-21">
887 <addForeignKeyConstraint baseColumnNames="modulus,exponent" baseTableName="user_rsa_keys"
888 baseTableSchemaName="benki" constraintName="user_rsa_keys_modulus_fkey" deferrable="false"
889 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
890 referencedColumnNames="modulus,exponent" referencedTableName="rsa_keys"
891 referencedTableSchemaName="benki" validate="true"/>
892 </changeSet>
893
894 <changeSet author="mulk (generated)" id="1592059602097-22">
895 <createIndex indexName="user_jids_user" schemaName="benki" tableName="user_jids">
896 <column name="user"/>
897 </createIndex>
898 </changeSet>
899
900 <changeSet author="mulk (generated)" id="1592059602097-23">
901 <createIndex indexName="user_nicknames_user" schemaName="benki" tableName="user_nicknames">
902 <column name="user"/>
903 </createIndex>
904 </changeSet>
905
906 <changeSet author="mulk (generated)" id="1592059602097-24">
907 <createTable schemaName="benki" tableName="bookmarks">
908 <column autoIncrement="true" name="id" type="INTEGER">
909 <constraints nullable="false" primaryKey="true" primaryKeyName="bookmarks_pkey"/>
910 </column>
911 <column name="owner" type="INTEGER"/>
912 <column defaultValueComputed="now()" name="date" type="TIMESTAMP WITH TIME ZONE"/>
913 <column name="uri" type="VARCHAR">
914 <constraints nullable="false"/>
915 </column>
916 <column name="title" type="VARCHAR"/>
917 <column name="description" type="VARCHAR"/>
918 </createTable>
919 </changeSet>
920
921 <changeSet author="mulk (generated)" id="1592059602097-25">
922 <createTable schemaName="benki" tableName="lazychat_messages">
923 <column autoIncrement="true" name="id" type="INTEGER">
924 <constraints nullable="false" primaryKey="true" primaryKeyName="lazychat_messages_pkey"/>
925 </column>
926 <column name="owner" type="INTEGER"/>
927 <column defaultValueComputed="now()" name="date" type="TIMESTAMP WITH TIME ZONE"/>
928 <column name="content" type="VARCHAR"/>
929 <column name="format" type="VARCHAR">
930 <constraints nullable="false"/>
931 </column>
932 </createTable>
933 </changeSet>
934
935 <changeSet author="mulk (generated)" id="1592059602097-26">
936 <addForeignKeyConstraint baseColumnNames="user" baseTableName="webids"
937 baseTableSchemaName="benki" constraintName="webids_user_fkey" deferrable="false"
938 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
939 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
940 </changeSet>
941
942 <changeSet author="mulk (generated)" id="1592059602097-27">
943 <addForeignKeyConstraint baseColumnNames="author" baseTableName="wiki_page_revisions"
944 baseTableSchemaName="benki" constraintName="wiki_page_revisions_author_fkey"
945 deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
946 referencedColumnNames="id" referencedTableName="users" referencedTableSchemaName="benki"
947 validate="true"/>
948 </changeSet>
949
950 <changeSet author="mulk (generated)" id="1592059602097-28">
951 <addForeignKeyConstraint baseColumnNames="user" baseTableName="page_keys"
952 baseTableSchemaName="benki" constraintName="page_keys_user_fkey" deferrable="false"
953 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
954 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
955 </changeSet>
956
957 <changeSet author="mulk (generated)" id="1592059602097-29">
958 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_rsa_keys"
959 baseTableSchemaName="benki" constraintName="user_rsa_keys_user_fkey" deferrable="false"
960 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
961 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
962 </changeSet>
963
964 <changeSet author="mulk (generated)" id="1592059602097-30">
965 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_email_addresses"
966 baseTableSchemaName="benki" constraintName="user_email_addresses_user_fkey" deferrable="false"
967 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
968 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
969 </changeSet>
970
971 <changeSet author="mulk (generated)" id="1592059602097-31">
972 <createView fullDefinition="false" schemaName="benki" viewName="effective_role_subroles">WITH
973 RECURSIVE t(superrole, subrole) AS (
974 SELECT roles.id,
975 roles.id
976 FROM roles
977 UNION
978 SELECT t_1.superrole,
979 rs.subrole
980 FROM (t t_1
981 JOIN role_subroles rs ON ((rs.superrole = t_1.subrole)))
982 )
983 SELECT t.superrole,
984 t.subrole
985 FROM t;
986 </createView>
987 </changeSet>
988
989 <changeSet author="mulk (generated)" id="1592059602097-32">
990 <addForeignKeyConstraint baseColumnNames="target" baseTableName="user_default_target"
991 baseTableSchemaName="benki" constraintName="user_default_target_target_fkey"
992 deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
993 referencedColumnNames="id" referencedTableName="roles" referencedTableSchemaName="benki"
994 validate="true"/>
995 </changeSet>
996
997 <changeSet author="mulk (generated)" id="1592059602097-33">
998 <addForeignKeyConstraint baseColumnNames="role" baseTableName="user_roles"
999 baseTableSchemaName="benki" constraintName="user_roles_role_fkey" deferrable="false"
1000 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1001 referencedTableName="roles" referencedTableSchemaName="benki" validate="true"/>
1002 </changeSet>
1003
1004 <changeSet author="mulk (generated)" id="1592059602097-34">
1005 <addForeignKeyConstraint baseColumnNames="role" baseTableName="users"
1006 baseTableSchemaName="benki" constraintName="users_role_fkey" deferrable="false"
1007 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1008 referencedTableName="roles" referencedTableSchemaName="benki" validate="true"/>
1009 </changeSet>
1010
1011 <changeSet author="mulk (generated)" id="1592059602097-35">
1012 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_default_target"
1013 baseTableSchemaName="benki" constraintName="user_default_target_user_fkey" deferrable="false"
1014 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1015 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1016 </changeSet>
1017
1018 <changeSet author="mulk (generated)" id="1592059602097-36">
1019 <addForeignKeyConstraint baseColumnNames="user" baseTableName="openids"
1020 baseTableSchemaName="benki" constraintName="openids_user_fkey" deferrable="false"
1021 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1022 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1023 </changeSet>
1024
1025 <changeSet author="mulk (generated)" id="1592059602097-37">
1026 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_jids"
1027 baseTableSchemaName="benki" constraintName="user_jids_user_fkey" deferrable="false"
1028 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1029 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1030 </changeSet>
1031
1032 <changeSet author="mulk (generated)" id="1592059602097-38">
1033 <addForeignKeyConstraint baseColumnNames="page" baseTableName="wiki_page_revisions"
1034 baseTableSchemaName="benki" constraintName="wiki_page_revisions_page_fkey" deferrable="false"
1035 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1036 referencedTableName="wiki_pages" referencedTableSchemaName="benki" validate="true"/>
1037 </changeSet>
1038
1039 <changeSet author="mulk (generated)" id="1592059602097-39">
1040 <createView fullDefinition="false" schemaName="benki" viewName="effective_user_roles">SELECT
1041 ur."user",
1042 er.subrole AS role
1043 FROM (user_roles ur
1044 JOIN effective_role_subroles er ON ((er.superrole = ur.role)))
1045 UNION
1046 SELECT u.id AS "user",
1047 rt.role
1048 FROM users u,
1049 role_tags rt
1050 WHERE ((rt.tag)::text = ANY (ARRAY[('everyone'::character varying)::text, ('world'::character
1051 varying)::text]))
1052 UNION
1053 SELECT NULL::integer AS "user",
1054 rt.role
1055 FROM role_tags rt
1056 WHERE ((rt.tag)::text = 'world'::text);
1057 </createView>
1058 </changeSet>
1059
1060 <changeSet author="mulk (generated)" id="1592059602097-40">
1061 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_roles"
1062 baseTableSchemaName="benki" constraintName="user_roles_user_fkey" deferrable="false"
1063 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1064 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1065 </changeSet>
1066
1067 <changeSet author="mulk (generated)" id="1592059602097-41">
1068 <addForeignKeyConstraint baseColumnNames="target" baseTableName="post_targets"
1069 baseTableSchemaName="benki" constraintName="lazychat_targets_target_fkey" deferrable="false"
1070 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1071 referencedTableName="roles" referencedTableSchemaName="benki" validate="true"/>
1072 </changeSet>
1073
1074 <changeSet author="mulk (generated)" id="1592059602097-42">
1075 <createView fullDefinition="false" schemaName="benki" viewName="user_visible_posts">SELECT
1076 eur."user",
1077 t.message
1078 FROM effective_user_roles eur,
1079 post_targets t
1080 WHERE (t.target = eur.role)
1081 UNION
1082 SELECT m.owner AS "user",
1083 m.id AS message
1084 FROM posts m;
1085 </createView>
1086 </changeSet>
1087
1088 <changeSet author="mulk (generated)" id="1592059602097-43">
1089 <addForeignKeyConstraint baseColumnNames="user" baseTableName="user_nicknames"
1090 baseTableSchemaName="benki" constraintName="user_nicknames_user_fkey" deferrable="false"
1091 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1092 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1093 </changeSet>
1094
1095 <changeSet author="mulk (generated)" id="1592059602097-44">
1096 <addForeignKeyConstraint baseColumnNames="owner" baseTableName="bookmarks"
1097 baseTableSchemaName="benki" constraintName="bookmarks_owner_fkey" deferrable="false"
1098 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1099 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1100 </changeSet>
1101
1102 <changeSet author="mulk (generated)" id="1592059602097-45">
1103 <createView fullDefinition="false" schemaName="benki" viewName="user_visible_bookmarks">SELECT
1104 uvp."user",
1105 uvp.message
1106 FROM (user_visible_posts uvp
1107 JOIN bookmarks bm ON ((bm.id = uvp.message)));
1108 </createView>
1109 </changeSet>
1110
1111 <changeSet author="mulk (generated)" id="1592059602097-46">
1112 <addForeignKeyConstraint baseColumnNames="owner" baseTableName="lazychat_messages"
1113 baseTableSchemaName="benki" constraintName="lazychat_messages_author_fkey" deferrable="false"
1114 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1115 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1116 </changeSet>
1117
1118 <changeSet author="mulk (generated)" id="1592059602097-47">
1119 <addForeignKeyConstraint baseColumnNames="referrer" baseTableName="lazychat_references"
1120 baseTableSchemaName="benki" constraintName="lazychat_references_referrer_fkey"
1121 deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
1122 referencedColumnNames="id" referencedTableName="lazychat_messages"
1123 referencedTableSchemaName="benki" validate="true"/>
1124 </changeSet>
1125
1126 <changeSet author="mulk (generated)" id="1592059602097-48">
1127 <createView fullDefinition="false" schemaName="benki" viewName="user_visible_lazychat_messages">
1128 SELECT uvp."user",
1129 uvp.message
1130 FROM (user_visible_posts uvp
1131 JOIN lazychat_messages lm ON ((lm.id = uvp.message)));
1132 </createView>
1133 </changeSet>
1134
1135 <changeSet author="mulk (generated)" id="1592059602097-49">
1136 <addForeignKeyConstraint baseColumnNames="owner" baseTableName="posts"
1137 baseTableSchemaName="benki" constraintName="posts_owner_fkey" deferrable="false"
1138 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1139 referencedTableName="users" referencedTableSchemaName="benki" validate="true"/>
1140 </changeSet>
1141
1142 <changeSet author="mulk (generated)" id="1592059602097-50">
1143 <addForeignKeyConstraint baseColumnNames="subrole" baseTableName="role_subroles"
1144 baseTableSchemaName="benki" constraintName="role_subroles_subrole_fkey" deferrable="false"
1145 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1146 referencedTableName="roles" referencedTableSchemaName="benki" validate="true"/>
1147 </changeSet>
1148
1149 <changeSet author="mulk (generated)" id="1592059602097-51">
1150 <addForeignKeyConstraint baseColumnNames="superrole" baseTableName="role_subroles"
1151 baseTableSchemaName="benki" constraintName="role_subroles_superrole_fkey" deferrable="false"
1152 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id"
1153 referencedTableName="roles" referencedTableSchemaName="benki" validate="true"/>
1154 </changeSet>
1155
1156 <changeSet author="mulk (generated)" id="1592059602097-52">
1157 <addForeignKeyConstraint baseColumnNames="bookmark" baseTableName="bookmark_tags"
1158 baseTableSchemaName="benki" constraintName="bookmark_tags_bookmark_fkey" deferrable="false"
1159 initiallyDeferred="false" onDelete="NO ACTION" onUpdate="CASCADE" referencedColumnNames="id"
1160 referencedTableName="bookmarks" referencedTableSchemaName="benki" validate="true"/>
1161 </changeSet>
1162
1163</databaseChangeLog>