-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
simple.changelog.with.id.xml
286 lines (254 loc) · 11 KB
/
simple.changelog.with.id.xml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<?xml version="1.0" encoding="UTF-8"?>
<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-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-latest.xsd
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd" changeLogId="7ca7df34-5cad-4019-a0be-4beb78d74490">
<changeSet id="1" author="nvoxland">
<comment>
You can add comments to changeSets.
They can even be multiple lines if you would like.
They aren't used to compute the changeSet MD5Sum, so you can update them whenever you want without causing problems.
</comment>
<createTable tableName="person">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="firstname" type="varchar(50)"/>
<column name="lastname" type="varchar(50)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet id="1.1" author="nvoxland">
<createSequence sequenceName="seq_person"/>
</changeSet>
<changeSet id="2" author="nvoxland">
<comment>Add a username column so we can use "person" for authentication</comment>
<addColumn tableName="person">
<column name="usernae" type="varchar(8)"/>
</addColumn>
</changeSet>
<changeSet id="3" author="nvoxland">
<comment>Fix misspelled "username" column</comment>
<renameColumn tableName="person" oldColumnName="usernae" newColumnName="username" columnDataType="varchar(8)"/>
</changeSet>
<changeSet id="5" author="nvoxland" contextFilter="test">
<insert tableName="person">
<column name="firstname" value="John"/>
<column name="lastname" value="Doe"/>
<column name="username" value="jdoe"/>
</insert>
<insert tableName="person">
<column name="firstname" value="Jane"/>
<column name="lastname" value="Doe"/>
<column name="username" value="janedoe"/>
</insert>
<insert tableName="person">
<column name="firstname" value="Bob"/>
<column name="lastname" value="Johnson"/>
<column name="username" value="bjohnson"/>
</insert>
</changeSet>
<changeSet id="6" author="nvoxland">
<comment>Don't keep username in the person table</comment>
<dropColumn tableName="person" columnName="username"/>
</changeSet>
<changeSet id="7" author="nvoxland">
<createTable tableName="employee">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="name" type="varchar(50)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet id="7" author="bjohnson" contextFilter="test">
<insert tableName="employee">
<column name="name" value="ACME Corp"/>
</insert>
<insert tableName="employee">
<column name="name" value="Widgets Inc."/>
</insert>
</changeSet>
<changeSet id="7a" author="nvoxland">
<addColumn tableName="employee">
<column name="company_id" type="int">
<constraints nullable="true" foreignKeyName="fk_employee_company" references="employee(id)"/>
</column>
</addColumn>
</changeSet>
<changeSet id="8" author="bjohnson">
<dropNotNullConstraint tableName="employee" columnName="name" columnDataType="varchar(50)"/>
</changeSet>
<!--<changeSet id="8.1" author="bjohnson">-->
<!--<comment>I guess name needs to be not-null</comment>-->
<!--<addNotNullConstraint tableName='employee' columnName="name" defaultNullValue="UNKNOWN" columnDataType="varchar(50)"/>-->
<!--</changeSet>-->
<changeSet id="9" author="nvoxland">
<renameTable oldTableName="employee" newTableName="company"/>
</changeSet>
<changeSet id="10" author="nvoxland">
<createTable tableName="testtable">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="value" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="person_id" type="int">
<constraints nullable="false" foreignKeyName="fk_test_person" references="person(id)"/>
</column>
</createTable>
</changeSet>
<changeSet id="11" author="nvoxland">
<dropTable tableName="testtable"/>
</changeSet>
<changeSet id="12" author="nvoxland">
<createIndex indexName="idx_company_name" tableName="company">
<column name="name"/>
</createIndex>
<createIndex indexName="idx_person_lastname" tableName="person">
<column name="lastname"/>
</createIndex>
</changeSet>
<changeSet id="13" author="nvoxland">
<dropIndex indexName="idx_person_lastname" tableName="person"/>
</changeSet>
<changeSet id="14" author="nvoxland">
<createTable tableName="liquibaseRunInfo">
<column name="timesRan" type="int"/>
</createTable>
<insert tableName="liquibaseRunInfo">
<column name="timesRan" valueNumeric="1"/>
</insert>
</changeSet>
<changeSet id="15" author="nvoxland">
<sql>update liquibaseRunInfo set timesRan=timesRan+1</sql>
</changeSet>
<changeSet id="16" author="nvoxland">
<createView viewName="personView">
select * from person
</createView>
</changeSet>
<changeSet id="16a" author="nvoxland">
<createSequence sequenceName="seq_test" startValue="1000" incrementBy="2" />
</changeSet>
<changeSet id="17" author="nvoxland">
<alterSequence sequenceName="seq_test" minValue="100"/>
</changeSet>
<changeSet id="18a" author="nvoxland">
<dropSequence sequenceName="seq_test"/>
</changeSet>
<changeSet id="18" author="nvoxland">
<dropView viewName="personView"/>
</changeSet>
<changeSet id="19" author="nvoxland">
<mergeColumns
tableName="person"
column1Name="firstname"
joinString=" "
column2Name="lastname"
finalColumnName="fullname"
finalColumnType="varchar(100)"/>
</changeSet>
<changeSet id="20" author="nvoxland">
<createView viewName="personView">
select id, fullname from person
</createView>
</changeSet>
<changeSet id="22" author="nvoxland">
<addColumn tableName="person">
<column name="employer_id" type="int"/>
</addColumn>
</changeSet>
<changeSet id="23" author="nvoxland">
<addForeignKeyConstraint
baseTableName="person" baseColumnNames="employer_id"
constraintName="fk_person_employer"
referencedTableName="company" referencedColumnNames="id"
deleteCascade="true"/>
</changeSet>
<changeSet id="24" author="nvoxland">
<dropForeignKeyConstraint baseTableName="person" constraintName="fk_person_employer"/>
</changeSet>
<changeSet id="25" author="nvoxland">
<createTable tableName="address">
<column name="id" type="int"/>
<column name="line1" type="varchar(255)"/>
<column name="line2" type="varchar(255)"/>
<column name="city" type="varchar(255)"/>
<column name="state" type="char(2)"/>
<column name="postalcode" type="varchar(15)"/>
</createTable>
</changeSet>
<changeSet id="25.1" author="nvoxland">
<addNotNullConstraint tableName="address" columnName="id" columnDataType="int"/>
</changeSet>
<changeSet id="25.2" author="nvoxland">
<addPrimaryKey tableName="address" columnNames="id" constraintName="pk_address"/>
</changeSet>
<changeSet id="25.3" author="nvoxland">
<addAutoIncrement tableName="address" columnName="id" columnDataType="int"/>
</changeSet>
<changeSet id="26" author="nvoxland">
<insert tableName="address">
<column name="line1" value="123 4th St"/>
<column name="line2" value="Suite 432"/>
<column name="city" value="New York"/>
<column name="state" value="NY"/>
<column name="postalcode" value="01235"/>
</insert>
<insert tableName="address">
<column name="line1" value="6123 64th St"/>
<column name="city" value="New York"/>
<column name="state" value="NY"/>
<column name="postalcode" value="01235"/>
</insert>
<insert tableName="address">
<column name="line1" value="One Liquibase Way"/>
<column name="city" value="Fargo"/>
<column name="state" value="ND"/>
<column name="postalcode" value="58103"/>
</insert>
<insert tableName="address">
<column name="line1" value="123 Main Ave"/>
<column name="city" value="City With No State"/>
<column name="postalcode" value="00000"/>
</insert>
</changeSet>
<changeSet id="28" author="nvoxland">
<addDefaultValue tableName="address" columnName="line2" defaultValue="N/A"/>
</changeSet>
<changeSet id="29" author="nvoxland">
<dropDefaultValue tableName="address" columnName="line2"/>
</changeSet>
<changeSet id="30" author="nvoxland">
<createTable tableName="pkTest">
<column name="id" type="int"/>
<column name="value" type="varchar(50)"/>
</createTable>
</changeSet>
<changeSet id="31" author="nvoxland">
<addPrimaryKey tableName="pkTest" columnNames="id" constraintName="pk_pktest"/>
</changeSet>
<changeSet id="32" author="nvoxland">
<dropPrimaryKey tableName="pkTest" constraintName="pk_pktest"/>
</changeSet>
<changeSet id="33" author="nvoxland">
<addUniqueConstraint tableName="address" columnNames="line1, line2" constraintName="uq_address_line1line2"/>
</changeSet>
<changeSet id="34" author="nvoxland">
<dropUniqueConstraint tableName="address" constraintName="uq_address_line1line2"/>
</changeSet>
<changeSet id="35" author="nvoxland">
<createTable tableName="tableToRollback">
<column name="id" type="int"/>
</createTable>
</changeSet>
<changeSet id="50" author="nvoxland">
<modifyDataType tableName="address" columnName="postalcode" newDataType="varchar(20)"/>
</changeSet>
</databaseChangeLog>