fix: set PAGER= to prevent psql hanging on non-interactive terminal
psql was launching less/more for query output in the CI shell, then blocking indefinitely on "Press RETURN to continue". Also batch all numbered migrations into one psql session instead of one process per file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -78,11 +78,16 @@ jobs:
|
||||
# we need it here for migrations)
|
||||
[ -d $APP_DIR/supabase ] || cp -r supabase $APP_DIR/supabase
|
||||
cd $APP_DIR
|
||||
PGPASSWORD="${POSTGRES_PASSWORD}" psql -h 127.0.0.1 -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -v ON_ERROR_STOP=0 -f supabase/migrations/000_preflight_supabase_compat.sql || true
|
||||
[ -f supabase/captured_schema.sql ] && PGPASSWORD="${POSTGRES_PASSWORD}" psql -h 127.0.0.1 -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -v ON_ERROR_STOP=0 -f supabase/captured_schema.sql || echo "captured_schema.sql not present, skipping"
|
||||
for f in supabase/migrations/[0-9]*.sql; do
|
||||
PGPASSWORD="${POSTGRES_PASSWORD}" psql -h 127.0.0.1 -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -v ON_ERROR_STOP=0 -q -f "$f" || echo "FAIL: $f"
|
||||
done
|
||||
# PAGER= prevents psql from launching less/more in a non-interactive shell,
|
||||
# which hangs indefinitely waiting for keypress. Batch all files into one
|
||||
# connection for speed instead of one psql invocation per file.
|
||||
export PAGER=
|
||||
export PGPASSWORD="${POSTGRES_PASSWORD}"
|
||||
PG="psql -h 127.0.0.1 -U ${POSTGRES_USER} -d ${POSTGRES_DB} --no-psqlrc -v ON_ERROR_STOP=0 -q"
|
||||
$PG -f supabase/migrations/000_preflight_supabase_compat.sql || true
|
||||
[ -f supabase/captured_schema.sql ] && $PG -f supabase/captured_schema.sql || true
|
||||
# Concatenate all numbered migrations and run in one session
|
||||
cat supabase/migrations/[0-9]*.sql | $PG
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
Reference in New Issue
Block a user