You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
600 B
29 lines
600 B
# -*- mode: shell-script -*-
|
|
|
|
POSTGRES_IMAGE=docker.0k.io/postgres:12.15.0-myc
|
|
|
|
|
|
ddb () {
|
|
docker run --rm -i \
|
|
-e PGPASSWORD="$PASSWORD" \
|
|
-e PGHOST="$HOST" \
|
|
-e PGUSER="$USER" \
|
|
-e PGPORT="$PORT" \
|
|
--entrypoint psql \
|
|
"${POSTGRES_IMAGE}" \
|
|
-qAt "$@"
|
|
}
|
|
|
|
|
|
##
|
|
## Entrypoints
|
|
##
|
|
|
|
db_install_extensions() {
|
|
local dbname="$1"
|
|
shift
|
|
for ext in "$@"; do
|
|
ddb -d "$dbname" < <(echo "CREATE EXTENSION IF NOT EXISTS $ext;") || return 1
|
|
info "Installed $ext extension on database '$dbname'."
|
|
done
|
|
}
|