Skip to content

docs: add a recipe for formatting declarative schemas - #883

Merged
psteinroe merged 1 commit into
mainfrom
docs/format-declarative-schemas
Oct 21, 2026
Merged

psteinroe merged 1 commit into
mainfrom
docs/format-declarative-schemas

Conversation

@psteinroe

Copy link
Copy Markdown
Collaborator

Adds a guide on running the formatter on SQL that tools generate, starting with Supabase declarative schemas and pg-delta. pg-delta only formats its output enough to be readable and doesn't plan to grow into a formatter, so the language server formatter is the one to run after each generation. Only docs and mkdocs.yml change.

  • New guide guides/formatting_declarative_schemas.md: run format --write on supabase/schemas and supabase/migrations after supabase db schema declarative sync, generate or db pull --declarative, and check formatting in CI.
  • pg-delta loads the schema files through Postgres, so formatting doesn't change the diff. The exception is a language sql body written as a string: Postgres stores it as written and the formatter reformats it by default, so the guide recommends skipFnBodies: true to keep a formatted schema syncing with zero diff. begin atomic bodies are stored parsed and aren't affected.
  • The local step doesn't use --changed, because it compares <base>...HEAD and misses files that were just generated and aren't committed yet.
  • features/formatting.md links to the guide and lists skipFnBodies in the options table, where it was missing.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@psteinroe
psteinroe merged commit c378ca1 into main Oct 21, 2026
9 checks passed
@psteinroe
psteinroe deleted the docs/format-declarative-schemas branch October 21, 2026 09:13
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.

1 participant