1
0

sample-data: replacing pipes ('|') with newlines now via customChange

this avoids database-specific code spread over all sample-data/*.xml files
This commit is contained in:
Michael Hoennig
2019-05-05 14:15:07 +02:00
parent 4c42d15c12
commit f8ed5069fb
7 changed files with 130 additions and 82 deletions

View File

@@ -16,26 +16,16 @@
separator=";"
tableName="asset">
</loadData>
</changeSet>
<changeSet id="20190502111400-2" author="mhoennig" context="sample-data,">
<!-- I've tried extracting this to a stored procedure, but a compatible call
is only possible with PostgresSQL 11.x, otherwise the call syntax
between H2 and PostgresSQL would be different which defeated the point.
-->
<sql dbms="h2">
UPDATE asset SET remark = replace(remark, '|', STRINGDECODE('\n'))
</sql>
<sql dbms="postgresql">
UPDATE asset SET remark = replace(remark, '|', E'\n')
</sql>
<customChange class="org.hostsharing.hsadminng.liquibase.ReplaceCustomChange">
<param name="tableName" value="asset" />
<param name="columnNames" value="remark" />
<param name="searchFor" value="|" />
<param name="replaceWith" value="\n" />
</customChange>
<rollback>
DELETE FROM asset;
</rollback>
</changeSet>
</databaseChangeLog>