1
0

adding Postgres configurations for dev-environment with sample-data

This commit is contained in:
Michael Hoennig
2019-05-04 13:59:12 +02:00
parent 24e76e03d1
commit 6efa167427
11 changed files with 168 additions and 25 deletions

View File

@ -36,22 +36,12 @@ spring:
serialization:
indent-output: true
datasource:
# this is just a common configuration for the dev-profiles h2mem, h2file and pgsql
type: com.zaxxer.hikari.HikariDataSource
# H2 in memory:
url: jdbc:h2:mem:hsadminng;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
# H2 in file:
# url: jdbc:h2:~/.hsadminng.h2db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: hsadminNg
password:
hikari:
poolName: Hikari
auto-commit: false
h2:
console:
enabled: false
jpa:
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
database: H2
show-sql: true
properties:
hibernate.id.new_generator_mappings: true
@ -60,7 +50,7 @@ spring:
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: true
liquibase:
contexts: dev,sample-data
contexts: dev
mail:
host: localhost
port: 25

View File

@ -0,0 +1,22 @@
# Configuration for the dev-profile using a file-based H2 database.
spring:
profiles:
active: h2,h2file
include:
- dev
- swagger
# Uncomment to activate TLS for the dev profile
#- tls
datasource:
url: url: jdbc:h2:~/.hsadminng.h2db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: hsadminNg
password:
h2:
console:
enabled: false
jpa:
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
database: H2
liquibase:
contexts: dev

View File

@ -0,0 +1,22 @@
# Configuration for the dev-profile using an in-memory H2 database.
spring:
profiles:
active: h2,h2mem
include:
- dev
- swagger
# Uncomment to activate TLS for the dev profile
#- tls
datasource:
url: jdbc:h2:mem:hsadminng;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: hsadminNg
password:
h2:
console:
enabled: false
jpa:
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
database: H2
liquibase:
contexts: dev,sample-data

View File

@ -0,0 +1,19 @@
# Configuration for the dev-profile using a Postgres database specified via environment.
spring:
profiles:
active: dev,pgsql
include:
- dev
- swagger
# Uncomment to activate TLS for the dev profile
#- tls
datasource:
url: ${HSADMINNG_DB_URL}
username: ${HSADMINNG_DB_USER}
password: ${HSADMINNG_DB_PASS}
jpa:
database-platform: io.github.jhipster.domain.util.FixedPostgreSQL82Dialect
database: POSTGRESQL
liquibase:
contexts: dev

View File

@ -18,11 +18,21 @@
</loadData>
</changeSet>
<changeSet id="20190502111400-2" author="mhoennig" context="sample-data">
<sql>
<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>
<rollback>
DELETE FROM asset;
</rollback>

View File

@ -19,8 +19,22 @@
</changeSet>
<changeSet id="20190403083736-3" author="mhoennig" context="sample-data">
<sql>
UPDATE customer SET contractual_address = replace(contractual_address, '|', STRINGDECODE('\n'))
<!-- 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>

View File

@ -19,10 +19,20 @@
</changeSet>
<changeSet id="20190502100700-2" author="mhoennig" context="sample-data">
<sql>
<!-- 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 membership SET remark = replace(remark, '|', STRINGDECODE('\n'))
</sql>
<sql dbms="postgresql">
UPDATE customer SET remark = replace(remark, '|', E'\n');
</sql>
<rollback>
DELETE FROM membership;
</rollback>

View File

@ -19,10 +19,20 @@
</changeSet>
<changeSet id="20190503152800-2" author="mhoennig" context="sample-data">
<sql>
<!-- 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 sepa_mandate SET remark = replace(remark, '|', STRINGDECODE('\n'))
</sql>
<sql dbms="postgresql">
UPDATE customer SET remark = replace(remark, '|', E'\n');
</sql>
<rollback>
DELETE FROM sepa_mandate;
</rollback>

View File

@ -19,10 +19,20 @@
</changeSet>
<changeSet id="20190502111400-2" author="mhoennig" context="sample-data">
<sql>
<!-- 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 share SET remark = replace(remark, '|', STRINGDECODE('\n'))
</sql>
<sql dbms="postgresql">
UPDATE customer SET remark = replace(remark, '|', E'\n');
</sql>
<rollback>
DELETE FROM share;
</rollback>