summaryrefslogtreecommitdiff
path: root/src/main/resources/db/changeLog-1.7.xml
blob: 8824115f6c61779c0af6dbd4a427396e25032de7 (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
<?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>

</databaseChangeLog>