Skip to content

Commit 68cdc99

Browse files
committed
Add created_at and created_by columns to series_sales table and fill them with default values.
1 parent 24c8a49 commit 68cdc99

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/main/resources/liquibase/version/0.4.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
<include file="0.4/2016-08-18--unique_slug_in_collections.xml" relativeToChangelogFile="true" />
1919
<include file="0.4/2016-08-22--series_sales.xml" relativeToChangelogFile="true" />
2020
<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" />
2122

2223
</databaseChangeLog>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<comment>Adds created_at and created_by columns to series_sales table and fills them with default data</comment>
10+
11+
<addColumn tableName="series_sales">
12+
<column name="created_at" type="DATETIME" defaultValueComputed="${NOW}">
13+
<constraints nullable="false" />
14+
</column>
15+
<column name="created_by" type="INTEGER"
16+
defaultValueComputed="SELECT u.id FROM users u WHERE u.role = 'ADMIN'">
17+
<constraints nullable="false"
18+
references="users(id)"
19+
foreignKeyName="fk_series_sales_created_by" />
20+
</column>
21+
</addColumn>
22+
23+
</changeSet>
24+
25+
</databaseChangeLog>

0 commit comments

Comments
 (0)