databases: fix creation by going back to gexec

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-12-05 13:39:14 +01:00
parent 735634ed60
commit 652ed466f8
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
1 changed files with 7 additions and 8 deletions

View File

@ -15,12 +15,11 @@
$$;"
- name: 'Create database: {{ db.name | mandatory }}'
command: >
docker exec -i {{ postgres_ha_cont_name }}
psql
--username={{ postgres_ha_admin_user }}
shell: >
echo "SELECT
'CREATE DATABASE \"{{ db.name }}\" WITH OWNER \"{{ db.get("user", db.name) }}\";'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '{{ db.name }}')\\\gexec" |
docker exec -i {{ postgres_ha_cont_name }} \
psql \
--username={{ postgres_ha_admin_user }} \
--port={{ postgres_ha_cont_port }}
--command
"SELECT
'CREATE DATABASE \"{{ db.name }}\" WITH OWNER \"{{ db.get("user", db.name) }}\";'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '{{ db.name }}');"