File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/main/resources/liquibase/version/0.4 Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 6
6
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd" >
7
7
8
8
<changeSet id =" add-creator-columns-to-series_sales_table" author =" cssru" context =" scheme" >
9
- <comment >Adds created_at and created_by columns to series_sales table and fills them with default data</comment >
10
9
11
10
<addColumn tableName =" series_sales" >
12
- <column name =" created_at" type =" DATETIME" defaultValueComputed =" ${NOW}" >
13
- <constraints nullable =" false" />
14
- </column >
11
+ <column name =" created_at" type =" DATETIME" />
15
12
<column name =" created_by" type =" INTEGER"
16
- defaultValueComputed=" SELECT u.id FROM users u WHERE u.role = 'ADMIN'" >
13
+ defaultValueComputed=" SELECT u.id FROM users u WHERE u.role = 'ADMIN' LIMIT 1 " >
17
14
<constraints nullable =" false"
18
15
references=" users(id)"
19
- foreignKeyName=" fk_series_sales_created_by " />
16
+ foreignKeyName=" fk_series_sales_users_id " />
20
17
</column >
21
18
</addColumn >
22
19
20
+ <update tableName =" series_sales" >
21
+ <column name =" created_at" type =" DATETIME" value =" NOW()" />
22
+ </update >
23
+
24
+ <addNotNullConstraint columnName =" created_at" columnDataType =" DATETIME" tableName =" series_sales" />
25
+
23
26
</changeSet >
24
27
25
28
</databaseChangeLog >
You can’t perform that action at this time.
0 commit comments