Browse Source

new: [postgres] new ``init-sql`` option in relation to init any database with given sql

framadate
Valentin Lab 6 years ago
parent
commit
bd96f63599
  1. 4
      postgres/hooks/postgres_database-relation-joined

4
postgres/hooks/postgres_database-relation-joined

@ -52,6 +52,10 @@ ensure_db_docker_running
## XXXvlab: should send all these into only one docker... ## XXXvlab: should send all these into only one docker...
if ! db_has_database "$DBNAME"; then if ! db_has_database "$DBNAME"; then
db_create "$DBNAME" || exit 1 db_create "$DBNAME" || exit 1
if sql=$(relation-get init-sql); then
ddb "$DBNAME" > /dev/null < <(e "$sql") || exit 1
fi
fi fi
if [ "${#extensions[@]}" -gt 0 ]; then if [ "${#extensions[@]}" -gt 0 ]; then
db_install_extensions "$DBNAME" "${extensions[@]}" || exit 1 db_install_extensions "$DBNAME" "${extensions[@]}" || exit 1

Loading…
Cancel
Save