membership sample data and some minor fixes

This commit is contained in:
Michael Hoennig 2019-05-02 10:48:32 +02:00
parent 89437ca067
commit 7f358cc7fe
6 changed files with 45 additions and 16 deletions

View File

@ -10,11 +10,6 @@
separator=";" separator=";"
quotchar="'" quotchar="'"
tableName="customer"> 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> </loadData>
<!-- Liquibase CSV files can contain linebreaks just as real linebreaks, but which <!-- Liquibase CSV files can contain linebreaks just as real linebreaks, but which

View File

@ -9,11 +9,18 @@
file="config/liquibase/sample-data/memberships.csv" file="config/liquibase/sample-data/memberships.csv"
separator=";" separator=";"
tableName="membership"> tableName="membership">
<column name="id" type="numeric"/>
<column name="customer" type="numeric"/>
<column name="jhi_from" type="date"/>
<column name="jhi_to" type="date"/>
</loadData> </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 membership SET remark = REPLACE(remark, '|', STRINGDECODE('\n'));
</sql>
<rollback>
DELETE FROM membership;
</rollback>
</changeSet> </changeSet>
</databaseChangeLog> </databaseChangeLog>

View File

@ -21,5 +21,6 @@
<!-- sample data --> <!-- sample data -->
<include file="config/liquibase/sample-data/customers.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/sample-data/customers.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/sample-data/memberships.xml" relativeToChangelogFile="false"/>
</databaseChangeLog> </databaseChangeLog>

View File

@ -1,6 +1,7 @@
id;customer_id;jhi_from;jhi_to id;customer_id;admission_document_date;cancellation_document_date;member_from_date;member_until_date;remark
1;1;2001-04-10;2007-12-31 1;1;2001-04-10;2007-08-09;2001-04-11;2007-12-31;is now client of another member|see XYZ
2;1;2017-01-15;null 2;1;2017-01-15;null;2017-01-15;null;nothing to say here
3;3;2003-05-15;2019-12-31 3;3;2003-05-11;2019-11-30;2003-05-15;2019-12-31;business discontinued
4;4;2017-05-15;null 4;4;2017-05-15;null;2017-05-15;null;whatever|is|to|say
5;5;2011-08-18;null 5;5;2011-08-18;null;2011-08-18;null;foo bar etc.

1 id customer_id jhi_from admission_document_date jhi_to cancellation_document_date member_from_date member_until_date remark
2 1 1 2001-04-10 2001-04-10 2007-12-31 2007-08-09 2001-04-11 2007-12-31 is now client of another member|see XYZ
3 2 1 2017-01-15 2017-01-15 null null 2017-01-15 null nothing to say here
4 3 3 2003-05-15 2003-05-11 2019-12-31 2019-11-30 2003-05-15 2019-12-31 business discontinued
5 4 4 2017-05-15 2017-05-15 null null 2017-05-15 null whatever|is|to|say
6 5 5 2011-08-18 2011-08-18 null null 2011-08-18 null foo bar etc.
7

View File

@ -0,0 +1,25 @@
<?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="20190502100700-1" author="mhoennig" context="sample-data">
<loadData encoding="UTF-8"
file="config/liquibase/sample-data/memberships.csv"
separator=";"
tableName="membership">
</loadData>
</changeSet>
<changeSet id="20190502100700-2" author="mhoennig" context="sample-data">
<sql>UPDATE membership SET remark = replace(remark, '|', '\n')</sql>
</changeSet>
</databaseChangeLog>

View File

@ -27,7 +27,7 @@
<tr *ngFor="let membership of memberships ;trackBy: trackId"> <tr *ngFor="let membership of memberships ;trackBy: trackId">
<td><a [routerLink]="['/membership', membership.id, 'view' ]">{{membership.id}}</a></td> <td><a [routerLink]="['/membership', membership.id, 'view' ]">{{membership.id}}</a></td>
<td>{{membership.admissionDocumentDate | date:'mediumDate'}}</td> <td>{{membership.admissionDocumentDate | date:'mediumDate'}}</td>
<td>{{membership.cancellationDocumentDate | date:'mediumDsate'}}</td> <td>{{membership.cancellationDocumentDate | date:'mediumDate'}}</td>
<td>{{membership.memberFromDate | date:'mediumDate'}}</td> <td>{{membership.memberFromDate | date:'mediumDate'}}</td>
<td>{{membership.memberUntilDate | date:'mediumDate'}}</td> <td>{{membership.memberUntilDate | date:'mediumDate'}}</td>
<td> <td>