Skip to content

chore(supabase): add generated consolidated schema.sql for fresh installs - #331

Merged
gkhngyk merged 1 commit into
mainfrom
docs/consolidated-schema-sql
Jul 2, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
docs/consolidated-schema-sql

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a generated, consolidated supabase/schema.sql so 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 under supabase/migrations/ is squashed or rewritten.

What's added

  • supabase/schema.sql — every migration in supabase/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 — regenerates schema.sql deterministically from the migrations, no DB required. Run it after adding a migration: bash supabase/build-schema.sh.
  • CI schema job (.github/workflows/ci.yml) — regenerates and fails the build if the committed schema.sql is out of date, so it can't silently drift from the migrations.
  • Docs — README.md and docs/self-host/supabase-setup.mdx now point the Dashboard/manual option at schema.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_dump snapshot 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 + docs

How to test

  1. bash supabase/build-schema.sh → regenerates supabase/schema.sql; re-running produces no diff (deterministic).
  2. Pasting supabase/schema.sql into 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.
  3. CI: the new schema job fails if schema.sql is stale (add a migration without regenerating → red).
  4. Existing installs are unaffected — they keep applying new numbered migrations / db push.

Checklist

…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.
@mintlify

mintlify Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ansvisor 🟢 Ready View Preview Jul 1, 2026, 2:57 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@gkhngyk
gkhngyk merged commit b9ef781 into main Jul 2, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the docs/consolidated-schema-sql branch July 2, 2026 19:48

This branch was successfully deployed

1 active deployment
staging - docs — d1f0fac8 Deployed Jul 1, 2026 by mintlify[bot]
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.

chore(self-host): add a consolidated schema.sql for fresh installs (keep incremental migrations as the upgrade path)

1 participant