kopia lustrzana https://github.com/kartoza/docker-postgis
Fix issue with multiple schema creation and modify existing tests
rodzic
98f3c97e7d
commit
421523f7fe
|
@ -20,7 +20,7 @@ services:
|
||||||
POSTGRES_DB: 'gis,data'
|
POSTGRES_DB: 'gis,data'
|
||||||
POSTGRES_PASS: 'docker'
|
POSTGRES_PASS: 'docker'
|
||||||
ALL_DATABASES: TRUE
|
ALL_DATABASES: TRUE
|
||||||
SCHEMA_NAME: demo
|
SCHEMA_NAME: 'demo1,demo2'
|
||||||
healthcheck:
|
healthcheck:
|
||||||
interval: 60s
|
interval: 60s
|
||||||
timeout: 30s
|
timeout: 30s
|
||||||
|
@ -40,7 +40,7 @@ services:
|
||||||
POSTGRES_DB: 'gis,data'
|
POSTGRES_DB: 'gis,data'
|
||||||
POSTGRES_PASS: 'docker'
|
POSTGRES_PASS: 'docker'
|
||||||
ALL_DATABASES: FALSE
|
ALL_DATABASES: FALSE
|
||||||
SCHEMA_NAME: demo
|
SCHEMA_NAME: 'demo1,demo2'
|
||||||
healthcheck:
|
healthcheck:
|
||||||
interval: 60s
|
interval: 60s
|
||||||
timeout: 30s
|
timeout: 30s
|
||||||
|
|
|
@ -140,7 +140,9 @@ done
|
||||||
|
|
||||||
# Create schemas in the DB
|
# Create schemas in the DB
|
||||||
for db in "${dbarr[@]}";do
|
for db in "${dbarr[@]}";do
|
||||||
for schema in $(echo "${SCHEMA_NAME}" | tr ',' ' '); do
|
IFS=','
|
||||||
|
read -a schema_arr <<< "$SCHEMA_NAME"
|
||||||
|
for schema in "${schema_arr[@]}";do
|
||||||
SCHEMA_RESULT=$(psql -t "${db}" -U "${POSTGRES_USER}" -p 5432 -h localhost -c "select count(1) from information_schema.schemata where schema_name = '${schema}' and catalog_name = '${db}';")
|
SCHEMA_RESULT=$(psql -t "${db}" -U "${POSTGRES_USER}" -p 5432 -h localhost -c "select count(1) from information_schema.schemata where schema_name = '${schema}' and catalog_name = '${db}';")
|
||||||
if [[ ${SCHEMA_RESULT} -eq 0 ]] && [[ "${ALL_DATABASES}" =~ [Ff][Aa][Ll][Ss][Ee] ]]; then
|
if [[ ${SCHEMA_RESULT} -eq 0 ]] && [[ "${ALL_DATABASES}" =~ [Ff][Aa][Ll][Ss][Ee] ]]; then
|
||||||
echo -e "\e[32m [Entrypoint] Creating schema \e[1;31m ${schema} \e[32m in database \e[1;31m ${SINGLE_DB} \033[0m"
|
echo -e "\e[32m [Entrypoint] Creating schema \e[1;31m ${schema} \e[32m in database \e[1;31m ${SINGLE_DB} \033[0m"
|
||||||
|
|
Ładowanie…
Reference in New Issue