46 lines
2.1 KiB
XML
46 lines
2.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<databaseChangeLog
|
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
|
|
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
|
<property name="now" value="now()" dbms="h2"/>
|
|
<property name="now" value="current_timestamp" dbms="postgresql"/>
|
|
<property name="floatType" value="float4" dbms="postgresql, h2"/>
|
|
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
|
|
|
|
<changeSet id="20190403083736-2" author="mhoennig" context="sample-data">
|
|
<loadData encoding="UTF-8"
|
|
file="config/liquibase/sample-data/customers.csv"
|
|
separator=";"
|
|
tableName="customer">
|
|
</loadData>
|
|
</changeSet>
|
|
|
|
<changeSet id="20190403083736-3" 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 customer SET contractual_address = replace(contractual_address, '|', STRINGDECODE('\n'));
|
|
UPDATE customer SET billing_address = replace(billing_address, '|', STRINGDECODE('\n'));
|
|
UPDATE customer SET remark = replace(remark, '|', STRINGDECODE('\n'));
|
|
</sql>
|
|
|
|
<sql dbms="postgresql">
|
|
UPDATE customer SET contractual_address = replace(contractual_address, '|', '\n');
|
|
UPDATE customer SET billing_address = replace(billing_address, '|', '\n');
|
|
UPDATE customer SET remark = replace(remark, '|', E'\n');
|
|
</sql>
|
|
|
|
<rollback>
|
|
DELETE FROM customer;
|
|
</rollback>
|
|
</changeSet>
|
|
|
|
</databaseChangeLog>
|