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

16
scripts/init-db.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
PG_BIN="${PG_BIN:-/opt/homebrew/opt/postgresql@17/bin}"
if ! "$PG_BIN/psql" -d postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname = 'queue'" | grep -q 1; then
"$PG_BIN/psql" -d postgres -v ON_ERROR_STOP=1 -c "CREATE ROLE queue LOGIN PASSWORD 'queue'"
fi
if ! "$PG_BIN/psql" -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname = 'queue'" | grep -q 1; then
"$PG_BIN/createdb" -O queue queue
fi
"$PG_BIN/psql" "postgres://queue:queue@localhost:5432/queue?sslmode=disable" -v ON_ERROR_STOP=1 -c "SELECT 1" >/dev/null
echo "PostgreSQL development database is ready."