line-breaks in customer address sanmple data + sample data separated

This commit is contained in:
Michael Hoennig 2019-04-09 10:11:10 +02:00
parent 0419e7cd21
commit fe60e789d1
8 changed files with 85 additions and 52 deletions

View File

@ -1,10 +1,8 @@
<?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">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -53,17 +51,5 @@
</createTable>
</changeSet>
<changeSet id="20190402141612-2" author="mhoennig" context="sample-data">
<loadData encoding="UTF-8"
file="config/liquibase/sample-data/customers.csv"
separator=";"
tableName="customer">
<column name="id" type="numeric"/>
<column name="jhi_number" type="numeric"/>
<column name="prefix" type="string"/>
</loadData>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -1,10 +1,8 @@
<?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">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -38,17 +36,5 @@
</changeSet>
<changeSet id="20190403083736-2" author="mhoennig" context="sample-data">
<loadData encoding="UTF-8"
file="config/liquibase/sample-data/contacts.csv"
separator=";"
tableName="contact">
<column name="id" type="numeric"/>
<column name="first_name" type="string"/>
<column name="last_name" type="string"/>
<column name="email" type="string"/>
</loadData>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -1,10 +1,8 @@
<?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">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -38,17 +36,5 @@
</changeSet>
<changeSet id="20190403083737-2" author="mhoennig" context="sample-data">
<loadData encoding="UTF-8"
file="config/liquibase/sample-data/customer-contacts.csv"
separator=";"
tableName="customer_contact">
<column name="id" type="numeric"/>
<column name="customer" type="numeric"/>
<column name="role" type="string"/>
<column name="contact" type="numeric"/>
</loadData>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">
<changeSet id="sample-data-Contact-01" author="mhoennig" context="sample-data">
<loadData encoding="UTF-8"
file="config/liquibase/sample-data/contacts.csv"
separator=";"
tableName="contact">
<column name="id" type="numeric"/>
<column name="first_name" type="string"/>
<column name="last_name" type="string"/>
<column name="email" type="string"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">
<changeSet id="sample-data-Customer-01" author="mhoennig" context="sample-data">
<loadData encoding="UTF-8"
file="config/liquibase/sample-data/customers.csv"
separator=";"
quotchar="'"
tableName="customer">
<column name="id" type="numeric"/>
<column name="jhi_number" type="numeric"/>
<column name="prefix" type="string"/>
<column name="name" type="string"/>
<column name="contractual_address" type="string"/>
</loadData>
<!-- Liquibase CSV files can contain linebreaks just as real linebreaks, but which
make the CSV files hard to read. Therefore I've encoded linebreaks as '|' and
replace these after import with '\n'. -->
<sql>
UPDATE customer SET contractual_address = REPLACE(contractual_address, '|', STRINGDECODE('\n'));
</sql>
<rollback>
DELETE FROM customer;
</rollback>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">
<changeSet id="sample-data-CustomerContact-01" author="mhoennig" context="sample-data">
<loadData encoding="UTF-8"
file="config/liquibase/sample-data/customer-contacts.csv"
separator=";"
tableName="customer_contact">
<column name="id" type="numeric"/>
<column name="customer" type="numeric"/>
<column name="role" type="string"/>
<column name="contact" type="numeric"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -17,4 +17,9 @@
<include file="config/liquibase/changelog/20190403083739_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083740_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
<include file="config/liquibase/changelog/sample-data-Customer.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/sample-data-Contact.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/sample-data-CustomerContact.xml" relativeToChangelogFile="false"/>
</databaseChangeLog>

View File

@ -1,7 +1,7 @@
id;jhi_number;prefix
1;10001;aaa
2;10002;bbb
3;10003;ccc
4;10004;ddd
5;10098;abc
6;10099;bca
id;jhi_number;prefix;name;contractual_address
1;10001;aaa;AAA Corp.;'Ballustrade 13|91334 Erlangen'
2;10002;bbb;BBB GmbH;'Irgendwo 0|11111 Berlin'
3;10003;ccc;CCC AG;'Haus 15|26539 Baltrum'
4;10004;ddd;DDD eG;'Industriestraße 98-102|n22999 Hamburg'
5;10098;abc;ABC OHG;'An der Weide 13|30123 Hannover'
6;10099;bca;Bert Cäsar Adelbert;'Egerstraße 53|44225 Dortmund'

1 id jhi_number prefix name contractual_address
2 1 10001 aaa AAA Corp. 'Ballustrade 13|91334 Erlangen'
3 2 10002 bbb BBB GmbH 'Irgendwo 0|11111 Berlin'
4 3 10003 ccc CCC AG 'Haus 15|26539 Baltrum'
5 4 10004 ddd DDD eG 'Industriestraße 98-102|n22999 Hamburg'
6 5 10098 abc ABC OHG 'An der Weide 13|30123 Hannover'
7 6 10099 bca Bert Cäsar Adelbert 'Egerstraße 53|44225 Dortmund'