Repository navigation
docs(backups): fix data dump so it restores, use the session pooler, add a restore check - #458
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e95043ee4b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| A dump that finishes without errors can still fail to restore. For example, a data dump that includes `storage.buckets_vectors` fails with `permission denied for table buckets_vectors` when you load it, which is why the commands above exclude that table and `storage.vector_indexes`. | ||
|
|
||
| To catch problems like this when the backup runs, add a step at the end of the job that loads the three files into a throwaway local database on the runner. It starts Postgres with `supabase db start` in a temporary directory and runs the restore command from [Backup and Restore using the CLI](https://supabase.com/docs/guides/platform/migrating-within-supabase/backup-restore). With `--single-transaction` and `ON_ERROR_STOP`, any error fails the step. |
There was a problem hiding this comment.
Move the restore check before auto-commit
When this instruction is followed for the Periodic Backups Workflow, “at the end of the job” places the check after stefanzweifel/git-auto-commit-action at docs/backups.md:79-81. If a dump is produced but cannot be restored—the exact case this section targets—the action has already committed and pushed that unusable dump before psql fails, so the latest published backup is not protected by the check; show or require this validation before the auto-commit step.
Useful? React with 👍 / 👎.
CLI v3 deprecates --db-url in favor of --remote=<db-url>, which the backup-restore guide already uses.
|
Thanks for your contribution! 🥳 |
What kind of change does this PR introduce?
Docs update to
docs/backups.md(rendered at https://supabase.com/docs/guides/deployment/ci/backups).What is the current behavior?
storage.buckets_vectors. Loading thatdata.sqlwith the restore command from the "Backup and Restore using the CLI" guide fails withpermission denied for table buckets_vectors. The guide itself already excludesstorage.buckets_vectorsandstorage.vector_indexes.db.<ref>.supabase.co). That's IPv6, and GitHub-hosted runners are IPv4 only, so the workflow can't connect unless the project has the IPv4 add-on.data.sqlto the repo. The only warning is "never back up to a public repository", but the file includesauth.users(emails and password hashes) and stays in Git history after it's deleted.actions/checkout@v2/@v3andgit-auto-commit-action@v4run on Node 12/16. actionlint reports checkout v2/v3 as too old to run on GitHub Actions./docs/guides/platform/migrating-and-upgrading-projects) now redirects to the upgrading page, which isn't about backups.What is the new behavior?
-x "storage.buckets_vectors" -x "storage.vector_indexes").actions/checkout@v5andgit-auto-commit-action@v5(v5 of git-auto-commit only changes the runtime to Node 20). I leftsupabase/setup-cli@v1alone so this page matches the other CI pages.supabase db startin a temp directory on the runner and loads the three files with the samepsql --single-transactioncommand as the backup-restore guide. If anything in the dump fails to load, the job fails.Additional context
How I tested it: I started a local database with
supabase db start(CLI 2.109.0), added a table with an RLS policy that usesauth.uid(), a custom role, rows inauth.usersandstorage.buckets, and ran the three dump commands from the page against it. Restoring the olddata.sqlinto a secondsupabase db startinstance with the guide's psql command failed onstorage.buckets_vectors. With the two-xflags it restored cleanly: same row counts, the policy and the custom role came back. Both workflows, with the new step appended, pass actionlint 1.7.12.I haven't run the full workflow on GitHub against a hosted project, so a quick run on your side would be good.