golang-template/scripts/goose.sh
2026-08-15 23:57:52 +03:00

16 lines
428 B
Bash
Executable file

#!/usr/bin/env bash
# Run goose against the Postgres database configured in .env
# Usage: ./scripts/goose.sh up | down | status | version
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -a
# shellcheck disable=SC1091
source "$SCRIPT_DIR/../.env"
set +a
export GOOSE_DRIVER="${GOOSE_DRIVER:-postgres}"
export GOOSE_MIGRATION_DIR="${GOOSE_MIGRATION_DIR:-$SCRIPT_DIR/../migrations}"
goose "$@"