File tree 2 files changed +40
-0
lines changed
src/main/resources/liquibase/version
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 18
18
<include file =" 0.4/2016-08-18--unique_slug_in_collections.xml" relativeToChangelogFile =" true" />
19
19
<include file =" 0.4/2016-08-22--series_sales.xml" relativeToChangelogFile =" true" />
20
20
<include file =" 0.4/2016-08-27--fix_series_sales_price.xml" relativeToChangelogFile =" true" />
21
+ <include file =" 0.4/2016-09-28--add_creator_data_to_series_sales.xml" relativeToChangelogFile =" true" />
21
22
22
23
</databaseChangeLog >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <databaseChangeLog
3
+ xmlns=" http://www.liquibase.org/xml/ns/dbchangelog"
4
+ xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
5
+ xsi:schemaLocation=" http://www.liquibase.org/xml/ns/dbchangelog
6
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd" >
7
+
8
+ <changeSet id =" add-creator-columns-to-series_sales_table" author =" cssru" context =" scheme" >
9
+ <!-- Since MySQL 5.6.5 it's possible to use `NOW()` as default value for a column
10
+ but we're doing the same in 3 steps to support also old versions. -->
11
+ <addColumn tableName =" series_sales" >
12
+ <column name =" created_at" type =" DATETIME" />
13
+ <column name =" created_by" type =" INTEGER" />
14
+ </addColumn >
15
+
16
+ <update tableName =" series_sales" >
17
+ <column name =" created_at" type =" DATETIME" valueComputed =" ${NOW}" />
18
+ </update >
19
+
20
+ <update tableName =" series_sales" >
21
+ <column name =" created_by"
22
+ type=" INTEGER"
23
+ valueComputed=" (SELECT id FROM users WHERE role = 'ADMIN' ORDER BY id LIMIT 1)" />
24
+ </update >
25
+
26
+ <addNotNullConstraint columnName =" created_at" columnDataType =" DATETIME" tableName =" series_sales" />
27
+
28
+ <addNotNullConstraint columnName =" created_by" columnDataType =" INTEGER" tableName =" series_sales" />
29
+
30
+ <addForeignKeyConstraint
31
+ baseColumnNames=" created_by"
32
+ baseTableName=" series_sales"
33
+ constraintName=" fk_series_sales_users_id"
34
+ referencedColumnNames=" id"
35
+ referencedTableName=" users" />
36
+
37
+ </changeSet >
38
+
39
+ </databaseChangeLog >
You can’t perform that action at this time.
0 commit comments