From a2f23569469ddf0ebec5a502100472f0763d23a1 Mon Sep 17 00:00:00 2001 From: remi-filament <30716308+remi-filament@users.noreply.github.com> Date: Wed, 23 Jan 2019 18:18:05 +0100 Subject: [PATCH] Add check for unaccent database --- entrypoint.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 5cf1d33..faf0a30 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,13 +30,10 @@ export PGUSER=$value check_config "db_password" "$PASSWORD" export PGPASSWORD=$value -result="$(psql -qc 'CREATE EXTENSION IF NOT EXISTS unaccent' 2>&1)" -ok=$? -if [ $ok -eq 0 -a -z "$result" ]; then - echo "INFO Unaccent extension installed" -elif [ $ok -ne 0 ]; then - echo "WARNING Attempt to install unaccent in \ - $PGDATABASE@$PGHOST failed with this message: $result" +if ! psql -l | grep $PGDATABASE; then + echo "Database $PGDATABASE does not exist" +else + psql -qc 'CREATE EXTENSION IF NOT EXISTS unaccent' fi case "$1" in -- GitLab