Repository navigation
chore(supabase): add generated consolidated schema.sql for fresh installs - #331
Merged
Merged
Conversation
…alls Closes #309. Fresh self-hosters can now paste one file instead of 20+ migrations, while the incremental migrations stay the source of truth and the upgrade path (never squashed/rewritten). - supabase/schema.sql — every migration concatenated in order (generated), for a one-paste fresh install via the Supabase SQL Editor. - supabase/build-schema.sh — regenerates it deterministically from supabase/migrations/ (no DB needed). - CI 'schema' job — regenerates and fails if the committed schema.sql is out of date, so it can't drift. - README + docs/self-host/supabase-setup.mdx — Dashboard option now points fresh installs at schema.sql; CLI db push + migrations remain the upgrade path.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This branch was successfully deployed
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.
Summary
Adds a generated, consolidated
supabase/schema.sqlso a fresh self-host install can be created with one paste into the Supabase SQL Editor instead of pasting 20+ migration files. The incremental migrations stay the source of truth and the upgrade path — nothing undersupabase/migrations/is squashed or rewritten.What's added
supabase/schema.sql— every migration insupabase/migrations/concatenated in order (generated). Running all migrations in one file produces the exact same schema as applying them sequentially, so pasting it once == the old "paste each file" flow.supabase/build-schema.sh— regeneratesschema.sqldeterministically from the migrations, no DB required. Run it after adding a migration:bash supabase/build-schema.sh.schemajob (.github/workflows/ci.yml) — regenerates and fails the build if the committedschema.sqlis out of date, so it can't silently drift from the migrations.README.mdanddocs/self-host/supabase-setup.mdxnow point the Dashboard/manual option atschema.sql(one paste), and note that the numbered migrations remain the source of truth + upgrade path.Why this shape (concatenation, not a
pg_dump)Concatenation is deterministic and needs no database, so the CI diff check can guarantee it never drifts. A
pg_dumpsnapshot would be cleaner-looking but requires DB access and is harder to verify in CI.Related issue
Closes #309
Type of change
chore— Maintenance / tooling + docsHow to test
bash supabase/build-schema.sh→ regeneratessupabase/schema.sql; re-running produces no diff (deterministic).supabase/schema.sqlinto a fresh Supabase project's SQL Editor creates the full schema (tables, indexes, RLS, triggers) in one run — equivalent to applying every migration in order.schemajob fails ifschema.sqlis stale (add a migration without regenerating → red).db push.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.md