summaryrefslogtreecommitdiff
path: root/src/main/resources/db/changeLog-1.8.xml
blob: 05948b08d0db3843375c4f1cf03cc4ff0d087735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
    http://www.liquibase.org/xml/ns/dbchangelog
    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd">

  <changeSet author="mulk" id="1.8-1">
    <sql>
      CREATE TYPE benki.post_scope AS ENUM ('top_level', 'comment');
    </sql>
  </changeSet>

  <changeSet author="mulk" id="1.8-2">
    <addColumn tableName="bookmarks" schemaName="benki">
      <column name="scope" type="benki.post_scope" defaultValue="top_level">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <addColumn tableName="lazychat_messages" schemaName="benki">
      <column name="scope" type="benki.post_scope" defaultValue="top_level">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <addColumn tableName="posts" schemaName="benki">
      <column name="scope" type="benki.post_scope" defaultValue="top_level">
        <constraints nullable="false"/>
      </column>
    </addColumn>

    <createIndex tableName="posts"
                 schemaName="benki"
                 indexName="post_scope_id_idx">
      <column name="scope"/>
      <column name="id"/>
    </createIndex>
  </changeSet>

  <changeSet id="1.8-3" author="mulk">
    <createIndex tableName="bookmarks"
                 schemaName="benki"
                 indexName="bookmarks_scope_id_idx">
      <column name="scope"/>
      <column name="id"/>
    </createIndex>

    <createIndex tableName="lazychat_messages"
                 schemaName="benki"
                 indexName="lazychat_messages_scope_id_idx">
      <column name="scope"/>
      <column name="id"/>
    </createIndex>
  </changeSet>

  <changeSet id="1.8-4" author="mulk">
    <sql>
      ALTER TABLE benki.role_tags DROP CONSTRAINT role_tags_tag_check;
      ALTER TABLE benki.role_tags ADD CONSTRAINT role_tags_tag_check CHECK (tag = ANY(ARRAY['admin', 'everyone', 'world', 'editor']));
    </sql>
  </changeSet>

</databaseChangeLog>