Skip to content

docs(backups): fix data dump so it restores, use the session pooler, add a restore check - #458

Merged
jgoux merged 5 commits into
supabase:gh-pagesfrom
supertj:docs/backups-restore-check
Nov 2, 2026
Merged

jgoux merged 5 commits into
supabase:gh-pagesfrom
supertj:docs/backups-restore-check

Conversation

@supertj

@supertj supertj commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

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?

  • The data dump command in both workflows doesn't exclude storage.buckets_vectors. Loading that data.sql with the restore command from the "Backup and Restore using the CLI" guide fails with permission denied for table buckets_vectors. The guide itself already excludes storage.buckets_vectors and storage.vector_indexes.
  • The example connection string is the direct connection (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.
  • The periodic workflow commits data.sql to the repo. The only warning is "never back up to a public repository", but the file includes auth.users (emails and password hashes) and stays in Git history after it's deleted.
  • actions/checkout@v2/@v3 and git-auto-commit-action@v4 run on Node 12/16. actionlint reports checkout v2/v3 as too old to run on GitHub Actions.
  • The "More resources" link (/docs/guides/platform/migrating-and-upgrading-projects) now redirects to the upgrading page, which isn't about backups.

What is the new behavior?

  • Data dump commands match the ones in the backup-restore guide (-x "storage.buckets_vectors" -x "storage.vector_indexes").
  • The example connection string is the session pooler, with a short note on why.
  • The note on the periodic workflow says what ends up in the repo and suggests a private bucket for anything beyond a small private project. The workflow itself is unchanged. I also removed two sentences saying the backup is "always available" and makes restoring "easy", since nothing in the workflow checks either.
  • actions/checkout@v5 and git-auto-commit-action@v5 (v5 of git-auto-commit only changes the runtime to Node 20). I left supabase/setup-cli@v1 alone so this page matches the other CI pages.
  • New "Check that the backup restores" section: one step that runs supabase db start in a temp directory on the runner and loads the three files with the same psql --single-transaction command as the backup-restore guide. If anything in the dump fails to load, the job fails.
  • "More resources" points to the backup-restore guide and the Database Backups page. I also added a third-party guide on scheduled GitHub Actions backups to your own bucket. Happy to drop that line if you'd rather keep the list to supabase.com.

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 uses auth.uid(), a custom role, rows in auth.users and storage.buckets, and ran the three dump commands from the page against it. Restoring the old data.sql into a second supabase db start instance with the guide's psql command failed on storage.buckets_vectors. With the two -x flags 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T15:07:25.568096Z 38375c3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/backups.md

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@jgoux

jgoux commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution! 🥳

@jgoux
jgoux merged commit 361050b into supabase:gh-pages Nov 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants