summaryrefslogtreecommitdiff
path: root/src/main/resources/db/changeLog-1.7.xml
blob: cfdad49f4826b44c474889e16aeb28b21afb7fbd (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
66
67
68
69
<?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.7-1">
    <createTable tableName="newsletters" schemaName="benki">
      <column name="id" type="INTEGER">
        <constraints primaryKeyName="newsletters_pkey" nullable="false" primaryKey="true"/>
      </column>

      <column name="date" type="TIMESTAMP WITH TIME ZONE">
        <constraints nullable="false"/>
      </column>
    </createTable>

    <addColumn tableName="bookmarks" schemaName="benki">
      <column name="newsletter" type="INTEGER">
        <constraints foreignKeyName="bookmarks_newsletter_fkey" references="benki.newsletters(id)"/>
      </column>
    </addColumn>

    <addColumn tableName="lazychat_messages" schemaName="benki">
      <column name="newsletter" type="INTEGER">
        <constraints foreignKeyName="lazychat_messages_newsletter_fkey" references="benki.newsletters(id)"/>
      </column>
    </addColumn>

    <addColumn tableName="posts" schemaName="benki">
      <column name="newsletter" type="INTEGER">
        <constraints foreignKeyName="posts_newsletter_fkey" references="benki.newsletters(id)"/>
      </column>
    </addColumn>
  </changeSet>

  <changeSet author="mulk" id="1.7-2">
    <createTable tableName="newsletter_subscriptions" schemaName="benki">
      <column name="id" type="SERIAL" autoIncrement="true">
        <constraints primaryKeyName="newsletter_subscriptions_pkey" nullable="false" primaryKey="true"/>
      </column>

      <column name="start_date" type="TIMESTAMP WITH TIME ZONE" defaultValue="now()">
        <constraints nullable="false"/>
      </column>

      <column name="email" type="VARCHAR">
        <constraints nullable="false" unique="true" uniqueConstraintName="newsletter_subscriptions_email_key"/>
      </column>
    </createTable>
  </changeSet>

  <changeSet author="mulk" id="1.7-3">
    <addColumn tableName="newsletter_subscriptions" schemaName="benki">
      <column name="registration_key" type="VARCHAR">
        <constraints unique="true" uniqueConstraintName="newsletter_subscriptions_registration_key_key"/>
      </column>
    </addColumn>

    <createIndex tableName="newsletter_subscriptions"
                 schemaName="benki"
                 indexName="newsletter_subscriptions_registration_key_idx">
      <column name="registration_key"/>
    </createIndex>
  </changeSet>

</databaseChangeLog>