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">
5 Liquibase update database with new change sets. Examples.
7 <changeSet author="gustavo test" id="1" labels="VERSIONA">
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=utf8mb4, COLLATE=utf8mb4_unicode_ci
13 <changeSet author="gustavo test" id="2" labels="VERSIONB">
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=utf8mb4, COLLATE=utf8mb4_unicode_ci
19 <changeSet author="gustavo test" id="3" labels="VERSIONC">
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=utf8mb4, COLLATE=utf8mb4_unicode_ci
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"/>
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"/>
38 <column defaultValue="1970-01-01 00:00:01" name="UPDATED_AT" type="TIMESTAMP">
39 <constraints nullable="false"/>
42 <modifySql dbms="mysql">
43 <append value="ENGINE=InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci"/>
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"/>
51 <column name="REVISION" type="BIGINT">
52 <constraints nullable="false"/>
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)"/>
69 <modifySql dbms="mysql">
70 <append value="ENGINE=InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci"/>
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"/>
78 <column name="LANGUAGE_ID" type="BIGINT">
79 <constraints nullable="false"/>
81 <column name="AD_ID" type="BIGINT"/>
82 <column name="AD_NAME" type="VARCHAR(255)">
83 <constraints nullable="false"/>
85 <column name="AD_DESCRIPTION" type="LONGTEXT"/>
86 <column name="AD_MOBILE_TEXT" type="VARCHAR(500)">
87 <constraints nullable="false"/>
89 <column name="AD_LINK" type="VARCHAR(3000)">
90 <constraints nullable="false"/>
93 <modifySql dbms="mysql">
94 <append value="ENGINE=InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci"/>
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"/>
102 <column name="REVISION" type="BIGINT">
103 <constraints nullable="false"/>
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"/>
115 <modifySql dbms="mysql">
116 <append value="ENGINE=InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci"/>
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"/>
124 <column name="REVISION_DATE" type="TIMESTAMP">
125 <constraints nullable="false"/>
127 <column name="USERNAME" type="VARCHAR(255)"/>
129 <modifySql dbms="mysql">
130 <append value="ENGINE=InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci"/>
133 <changeSet author="gustavo (generated)" id="1469119656864-6" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
134 <createTable tableName="con_test">
135 <column name="a" type="CHAR(1)"/>
138 <changeSet author="gustavo (generated)" id="1469119656864-7" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
139 <addPrimaryKey columnNames="ID, REVISION" constraintName="PK_AD_AUDITED" tableName="AD_AUDITED"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>