|
@ -45,20 +45,23 @@ else |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
POSTGIS=$(relation-get postgis 2>/dev/null) || true |
|
|
|
|
|
UNACCENT=$(relation-get unaccent 2>/dev/null) || true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
array_read-0 extensions < <(relation-get extensions 2>/dev/null | shyaml get-values-0) |
|
|
|
|
|
|
|
|
ensure_db_docker_running |
|
|
ensure_db_docker_running |
|
|
|
|
|
|
|
|
## XXXvlab: should send all these into only one docker... |
|
|
## XXXvlab: should send all these into only one docker... |
|
|
db_has_database "$DBNAME" || UNACCENT="$UNACCENT" POSTGIS="$POSTGIS" db_create "$DBNAME" |
|
|
|
|
|
|
|
|
if ! db_has_database "$DBNAME"; then |
|
|
|
|
|
db_create "$DBNAME" || exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
if [ "${#extensions[@]}" -gt 0 ]; then |
|
|
|
|
|
db_install_extensions "$DBNAME" "${extensions[@]}" || exit 1 |
|
|
|
|
|
fi |
|
|
if ! db_has_user "$USER"; then |
|
|
if ! db_has_user "$USER"; then |
|
|
info "Creating a new user $USER." |
|
|
info "Creating a new user $USER." |
|
|
db_create_user "$USER" "$PASSWORD" |
|
|
|
|
|
|
|
|
db_create_user "$USER" "$PASSWORD" || exit 1 |
|
|
else |
|
|
else |
|
|
info "Updating password of user $USER." |
|
|
info "Updating password of user $USER." |
|
|
db_change_password "$USER" "$PASSWORD" |
|
|
|
|
|
|
|
|
db_change_password "$USER" "$PASSWORD" || exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
db_grant_rights "$DBNAME" "$USER" |
|
|
db_grant_rights "$DBNAME" "$USER" |
|
|