Initial commit

This commit is contained in:
wangxuming
2026-07-12 15:53:24 +08:00
commit 68d61700d5
252 changed files with 23291 additions and 0 deletions

27
scripts/test-postgres.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PG_BIN="${PG_BIN:-/opt/homebrew/opt/postgresql@17/bin}"
TEST_DB="queue_schema_test_$$"
cleanup() {
"$PG_BIN/dropdb" --if-exists --force "$TEST_DB" >/dev/null 2>&1 || true
}
trap cleanup EXIT INT TERM
"$PG_BIN/createdb" -O queue "$TEST_DB"
(
export TEST_DATABASE_URL="postgres://queue:queue@localhost:5432/$TEST_DB?sslmode=disable"
cd "$ROOT_DIR/server"
go test ./internal/database -run TestPostgresMigrationAndMaintenanceIntegration -count=1
)
set -a
source "$ROOT_DIR/server/.env"
set +a
export APP_ENV=development
export DATABASE_URL="postgres://queue:queue@localhost:5432/$TEST_DB?sslmode=disable"
export MIGRATE_ON_START=false
export SUPER_ADMIN_PASSWORD='IntegrationOnlyPassword123!'
(cd "$ROOT_DIR/server" && go run ./cmd/bootstrap-admin >/dev/null)