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

  1. # -*- mode: shell-script -*-
  2. POSTGRES_IMAGE=docker.0k.io/postgres:12.15.0-myc
  3. ddb () {
  4. docker run --rm -i \
  5. -e PGPASSWORD="$PASSWORD" \
  6. -e PGHOST="$HOST" \
  7. -e PGUSER="$USER" \
  8. -e PGPORT="$PORT" \
  9. --entrypoint psql \
  10. "${POSTGRES_IMAGE}" \
  11. -qAt "$@"
  12. }
  13. ##
  14. ## Entrypoints
  15. ##
  16. db_install_extensions() {
  17. local dbname="$1"
  18. shift
  19. for ext in "$@"; do
  20. ddb -d "$dbname" < <(echo "CREATE EXTENSION IF NOT EXISTS $ext;") || return 1
  21. info "Installed $ext extension on database '$dbname'."
  22. done
  23. }