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