From 2d3c9951354fb100296604f010f5a24b3ae7aace Mon Sep 17 00:00:00 2001 From: tyler Date: Fri, 5 Jun 2026 20:05:50 -0600 Subject: [PATCH] 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 --- .gitea/workflows/deploy.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5118eac..6b87b2a 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -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