Repository navigation
Database changes through GitHub Actions: staging first, then production - #10
Merged
Merged
Conversation
…uction - Baseline: the shared schema captured from production (public schema with the check-in tables, functions, triggers, policies and grants, plus our storage policies and Realtime membership) in one migration; the four hand-applied migrations move to supabase/archive/. A second migration adds the resumes bucket and the DH26 event row if missing. Both applied to the new staging project, which then matched production exactly: schema, grants, storage policies and Realtime. - Grants are reset per object before production's exact grants, because a fresh project's default privileges would otherwise give the API roles more. - supabase-ci (PRs): migration rules, new migrations tried on staging in a rolled-back transaction, edge functions type-checked. - supabase-deploy (main): staging push, lint and functions, then production dry run, push and functions; production stays locked until SUPABASE_PROD_BOOTSTRAPPED is set after the one-time history repair. - supabase-drift and supabase-backup run nightly; the backup is encrypted with BACKUP_PASSPHRASE before it leaves the runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EgBz2EXk65565W9vj1xQ75
…et already ran Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EgBz2EXk65565W9vj1xQ75
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Database changes now go through GitHub Actions: every change lands on the staging project first and reaches production only if staging succeeded. Until now, migrations were pasted into the SQL editor by hand.
What's in it
supabase/migrations/20261022140000_baseline.sqlis the shared schema captured from production withpg_dump --schema-only. It includes the portal tables, the check-in system's tables and functions (which were never in a repo), triggers, row-level security, grants, our storage policies onresumes, and theattendeesRealtime membership. The four hand-applied migrations move tosupabase/archive/, since their effect is in the baseline.20261022140100_baseline_data.sqladds the privateresumesbucket and the DH26 event row if they're missing; neither is applicant data.gpoqlosneoicpzrluilj) withsupabase db push. Staging and production were then compared: structure, grants (84 lines), storage policies and Realtime are identical, andsupabase db lintfinds no errors.anonandauthenticatedaccess to every new object; production had revoked some, such asrelease_decisionsandadd_organizerforanon. The baseline resets each object's grants before applying production's exact ones.supabase-ci(PRs):mainand abandoned PRs leave nothing behind.supabase-deploy(merge tomain, one run at a time):db push, lint, then deploysend-emailandsend-wallet-passes.supabase-production): dry run,db push, then deploy the functions.SUPABASE_PROD_BOOTSTRAPPED=true.supabase-drift(nightly): fails if production's schema snapshot differs from staging's, which catches hand edits in the dashboard. It compares structure only, never data.supabase-backup(nightly):pg_dumpof production (publicandauth), encrypted withBACKUP_PASSPHRASEbefore upload and kept 7 days. The repo is public, so only the encrypted file is uploaded. It skips with a warning until the secret exists.supabase/config.toml: project id, Postgres 17, andverify_jwt = truefor each function. It's never used forconfig push.supabase/functions/deno.json: so the functions type-check in CI.docs/application-portal-todo.md.Tested locally:
deno checkon all three functionstscandvitest(78 tests pass)action-validatoron all four workflowsThe workflows themselves haven't run on GitHub yet.
Before this deploys anything to production
BACKUP_PASSPHRASEsecret: a long random passphrase, also kept in the team password manager.supabase-productionEnvironment (Settings → Environments), limited tomain.main: require PRs and thesupabase-cichecks, since a merge now changes production.🤖 Generated with Claude Code