2fd98a8bbe198c540e98ad43114cb2ac1820ccba
[JavaForFun] /
1 <?xml version="1.1" encoding="UTF-8" standalone="no"?>
2 <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
3
4     <!--
5         Liquibase update database with new change sets. Examples.
6
7     <changeSet author="gustavo test" id="1" labels="VERSIONA">
8         <sql>
9             CREATE TABLE VERSIONA (id SERIAL, company_id BIGINT, company_categ_id BIGINT, ad_gps BLOB, ad_mobile_image varchar(255), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci
10         </sql>
11     </changeSet>
12
13     <changeSet author="gustavo test" id="2" labels="VERSIONB">
14         <sql>
15             CREATE TABLE VERSIONB (id SERIAL, company_id BIGINT, company_categ_id BIGINT, ad_gps BLOB, ad_mobile_image varchar(255), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci
16         </sql>
17     </changeSet>
18
19     <changeSet author="gustavo test" id="3" labels="VERSIONC">
20         <sql>
21             CREATE TABLE VERSIONC (id SERIAL, company_id BIGINT, company_categ_id BIGINT, ad_gps BLOB, ad_mobile_image varchar(255), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB, DEFAULT CHARSET=utf8, COLLATE=utf8_unicode_ci
22         </sql>
23     </changeSet>
24     -->
25
26     <changeSet author="gustavo (generated)" id="1469119656864-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
27         <createTable tableName="AD">
28             <column autoIncrement="true" name="ID" type="BIGINT">
29                 <constraints primaryKey="true"/>
30             </column>
31             <column name="COMPANY_ID" type="BIGINT"/>
32             <column name="COMPANY_CATEG_ID" type="BIGINT"/>
33             <column name="AD_GPS" type="BLOB"/>
34             <column name="AD_MOBILE_IMAGE" type="VARCHAR(255)"/>
35             <column defaultValueComputed="CURRENT_TIMESTAMP" name="CREATED_AT" type="TIMESTAMP">
36                 <constraints nullable="false"/>
37             </column>
38             <column defaultValue="0000-00-00 00:00:00" name="UPDATED_AT" type="TIMESTAMP">
39                 <constraints nullable="false"/>
40             </column>
41         </createTable>
42         <modifySql dbms="mysql">
43             <append value="ENGINE=InnoDB CHARSET=utf8 COLLATE utf8_unicode_ci"/>
44         </modifySql>
45     </changeSet>
46     <changeSet author="gustavo (generated)" id="1469119656864-2" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
47         <createTable tableName="AD_AUDITED">
48             <column name="ID" type="BIGINT">
49                 <constraints nullable="false"/>
50             </column>
51             <column name="REVISION" type="BIGINT">
52                 <constraints nullable="false"/>
53             </column>
54             <column name="REVISION_TYPE" type="TINYINT(3)"/>
55             <column name="REVISION_END" type="BIGINT"/>
56             <column name="REVISION_END_TIMESTAMP" type="datetime"/>
57             <column name="AD_MOBILE_IMAGE" type="VARCHAR(255)"/>
58             <column name="adMobileImage_MODIFIED" type="BIT(1)"/>
59             <column name="COMPANY_CATEG_ID" type="BIGINT"/>
60             <column name="companyCategId_MODIFIED" type="BIT(1)"/>
61             <column name="COMPANY_ID" type="BIGINT"/>
62             <column name="companyId_MODIFIED" type="BIT(1)"/>
63             <column name="CREATED_AT" type="datetime"/>
64             <column name="createdAt_MODIFIED" type="BIT(1)"/>
65             <column name="UPDATED_AT" type="datetime"/>
66             <column name="updatedAt_MODIFIED" type="BIT(1)"/>
67             <column name="adDescriptions_MODIFIED" type="BIT(1)"/>
68         </createTable>
69         <modifySql dbms="mysql">
70             <append value="ENGINE=InnoDB CHARSET=utf8 COLLATE utf8_unicode_ci"/>
71         </modifySql>
72     </changeSet>
73     <changeSet author="gustavo (generated)" id="1469119656864-3" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
74         <createTable tableName="AD_DESCRIPTION">
75             <column autoIncrement="true" name="ID" type="BIGINT">
76                 <constraints primaryKey="true"/>
77             </column>
78             <column name="LANGUAGE_ID" type="BIGINT">
79                 <constraints nullable="false"/>
80             </column>
81             <column name="AD_ID" type="BIGINT"/>
82             <column name="AD_NAME" type="VARCHAR(255)">
83                 <constraints nullable="false"/>
84             </column>
85             <column name="AD_DESCRIPTION" type="LONGTEXT"/>
86             <column name="AD_MOBILE_TEXT" type="VARCHAR(500)">
87                 <constraints nullable="false"/>
88             </column>
89             <column name="AD_LINK" type="VARCHAR(3000)">
90                 <constraints nullable="false"/>
91             </column>
92         </createTable>
93         <modifySql dbms="mysql">
94             <append value="ENGINE=InnoDB CHARSET=utf8 COLLATE utf8_unicode_ci"/>
95         </modifySql>
96     </changeSet>
97     <changeSet author="gustavo (generated)" id="1469119656864-4" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
98         <createTable tableName="AD_DESCRIPTION_AUDITED">
99             <column name="ID" type="BIGINT">
100                 <constraints nullable="false"/>
101             </column>
102             <column name="REVISION" type="BIGINT">
103                 <constraints nullable="false"/>
104             </column>
105             <column name="REVISION_TYPE" type="TINYINT(3)"/>
106             <column name="REVISION_END" type="BIGINT"/>
107             <column name="REVISION_END_TIMESTAMP" type="datetime"/>
108             <column name="AD_DESCRIPTION" type="VARCHAR(255)"/>
109             <column name="AD_LINK" type="VARCHAR(255)"/>
110             <column name="AD_MOBILE_TEXT" type="VARCHAR(255)"/>
111             <column name="AD_NAME" type="VARCHAR(255)"/>
112             <column name="LANGUAGE_ID" type="BIGINT"/>
113             <column name="AD_ID" type="BIGINT"/>
114         </createTable>
115         <modifySql dbms="mysql">
116             <append value="ENGINE=InnoDB CHARSET=utf8 COLLATE utf8_unicode_ci"/>
117         </modifySql>
118     </changeSet>
119     <changeSet author="gustavo (generated)" id="1469119656864-5" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
120         <createTable tableName="CUSTOM_REVISION">
121             <column autoIncrement="true" name="ID" type="BIGINT">
122                 <constraints primaryKey="true"/>
123             </column>
124             <column name="REVISION_DATE" type="TIMESTAMP">
125                 <constraints nullable="false"/>
126             </column>
127             <column name="USERNAME" type="VARCHAR(255)"/>
128         </createTable>
129         <modifySql dbms="mysql">
130             <append value="ENGINE=InnoDB CHARSET=utf8 COLLATE utf8_unicode_ci"/>
131         </modifySql>
132     </changeSet>
133     <changeSet author="gustavo (generated)" id="1469119656864-6" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
134         <createTable tableName="con_test">
135             <column name="a" type="CHAR(1)"/>
136         </createTable>
137     </changeSet>
138     <changeSet author="gustavo (generated)" id="1469119656864-7" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
139         <addPrimaryKey columnNames="ID, REVISION" constraintName="PK_AD_AUDITED" tableName="AD_AUDITED"/>
140     </changeSet>
141     <changeSet author="gustavo (generated)" id="1469119656864-8" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
142         <addPrimaryKey columnNames="ID, REVISION" constraintName="PK_AD_DESCRIPTION_AUDITED" tableName="AD_DESCRIPTION_AUDITED"/>
143     </changeSet>
144     <changeSet author="gustavo (generated)" id="1469119656864-10" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
145         <createIndex indexName="IND_01_AD_DESCRIPTION" tableName="AD_DESCRIPTION">
146             <column name="AD_ID"/>
147         </createIndex>
148     </changeSet>
149     <changeSet author="gustavo (generated)" id="1469119656864-11" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
150         <createIndex indexName="IND_01_AD_DESCRIPTION_AUDITED" tableName="AD_DESCRIPTION_AUDITED">
151             <column name="REVISION"/>
152         </createIndex>
153     </changeSet>
154     <changeSet author="gustavo (generated)" id="1469119656864-12" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
155         <createIndex indexName="IND_01_AD_AUDITED" tableName="AD_AUDITED">
156             <column name="REVISION"/>
157         </createIndex>
158     </changeSet>
159     <changeSet author="gustavo (generated)" id="1469119656864-13" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
160         <createIndex indexName="IND_02_AD_AUDITED" tableName="AD_AUDITED">
161             <column name="REVISION_END"/>
162         </createIndex>
163     </changeSet>
164     <changeSet author="gustavo (generated)" id="1469119656864-14" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
165         <createIndex indexName="IND_02_AD_DESCRIPTION_AUDITED" tableName="AD_DESCRIPTION_AUDITED">
166             <column name="REVISION_END"/>
167         </createIndex>
168     </changeSet>
169     <changeSet author="gustavo (generated)" id="1469119656864-15" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
170         <addForeignKeyConstraint baseColumnNames="AD_ID" baseTableName="AD_DESCRIPTION" constraintName="FK_01_AD_DESCRIPTION" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="ID" referencedTableName="AD"/>
171     </changeSet>
172     <changeSet author="gustavo (generated)" id="1469119656864-16" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
173         <addForeignKeyConstraint baseColumnNames="REVISION" baseTableName="AD_DESCRIPTION_AUDITED" constraintName="FK_01_AD_DESCRIPTION_AUDITED" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="ID" referencedTableName="CUSTOM_REVISION"/>
174     </changeSet>
175     <changeSet author="gustavo (generated)" id="1469119656864-17" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
176         <addForeignKeyConstraint baseColumnNames="REVISION" baseTableName="AD_AUDITED" constraintName="FK_01_AD_AUDITED" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="ID" referencedTableName="CUSTOM_REVISION"/>
177     </changeSet>
178     <changeSet author="gustavo (generated)" id="1469119656864-18" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
179         <addForeignKeyConstraint baseColumnNames="REVISION_END" baseTableName="AD_AUDITED" constraintName="FK_02_AD_AUDITED" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="ID" referencedTableName="CUSTOM_REVISION"/>
180     </changeSet>
181     <changeSet author="gustavo (generated)" id="1469119656864-19" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
182         <addForeignKeyConstraint baseColumnNames="REVISION_END" baseTableName="AD_DESCRIPTION_AUDITED" constraintName="FK_02_AD_DESCRIPTION_AUDITED" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="ID" referencedTableName="CUSTOM_REVISION"/>
183     </changeSet>
184 </databaseChangeLog>