kopia lustrzana https://github.com/kartoza/docker-postgis
Fix issue with multiple schema creation and modify existing tests (#454)
rodzic
98f3c97e7d
commit
1468f485e0
|
@ -20,7 +20,7 @@ services:
|
|||
POSTGRES_DB: 'gis,data'
|
||||
POSTGRES_PASS: 'docker'
|
||||
ALL_DATABASES: TRUE
|
||||
SCHEMA_NAME: demo
|
||||
SCHEMA_NAME: 'demo1,demo2'
|
||||
healthcheck:
|
||||
interval: 60s
|
||||
timeout: 30s
|
||||
|
@ -40,7 +40,7 @@ services:
|
|||
POSTGRES_DB: 'gis,data'
|
||||
POSTGRES_PASS: 'docker'
|
||||
ALL_DATABASES: FALSE
|
||||
SCHEMA_NAME: demo
|
||||
SCHEMA_NAME: 'demo1,demo2'
|
||||
healthcheck:
|
||||
interval: 60s
|
||||
timeout: 30s
|
||||
|
|
|
@ -140,7 +140,9 @@ done
|
|||
|
||||
# Create schemas in the DB
|
||||
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}';")
|
||||
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"
|
||||
|
|
Ładowanie…
Reference in New Issue