src/sql/support.ts; this page, supaschema audit, extraction diagnostics, and deparser-gap handling must stay aligned with that file.
supaschema is fail-closed. Unsupported DDL blocks migration generation instead of guessing.
Extraction and checking are AST-only. Statements are classified through the PostgreSQL parser, never regex. Declarative schema objects become a SchemaModel; existing migrations become a source-intent model for operational facts that cannot be proven from the final schema shape alone.
Generated TypeScript and Zod contracts use the same schema model. An unknown result indicates missing coverage only when a modeled relation, function, extension, or expression fact should resolve; unsupported PostgreSQL scalars intentionally preserve the upstream unknown fallback. Fix missing modeled facts in the schema source, supported extension model, extractor, or typegen diagnostic path, not in application casts or copied contracts.
Migration-derived source intent
These classes are not inferred from the final table shape. They are supported only when the intent is explicit in declarative SQL, existing migrations, config, checked workload artifacts, or reviewed hints.
When any required source is missing, the planner should block with a diagnostic that tells the agent where to add the missing intent before rerunning
diff, plan, or sync.
Explicitly unsupported boundaries
Managed schemas
Objects in configuredmanagedSchemas are blocked before rendering. Generic PostgreSQL installs default to managedSchemas: []. Supabase installs seed the common Supabase-provisioned schemas: auth, storage, realtime, vault, extensions, cron, net, supabase_functions, graphql, and graphql_public, and also seed those names into schemas.exclude so provider-owned inventory does not block normal diffs.
Verify environment stub
verify --ensure-environment provisions a minimal stand-in for the Supabase-provisioned surface so a declarative tree that references managed schemas can apply against bare PostgreSQL:
auth.userswith the stable GoTrue column set (id,aud,role,email,phone,raw_app_meta_data,raw_user_meta_data,last_sign_in_at,is_anonymous, …).auth.sessionswith the stable identity and session metadata columns used by declarative views.- The
auth.uid(),auth.role(),auth.jwt(), andauth.email()helper functions. - The
vault.secretstable,vault.decrypted_secretsview, and create/update helpers. - The
cron.jobandcron.job_run_detailstables.
pg_cron extension object because PostgreSQL only permits it in the configured cron database (normally postgres), never in the disposable databases used for replay. Cron relation references remain covered by the environment stub.
The stub is an approximation. It does not create every managed object, such as storage.*, realtime.*, or auth.identities.
If a migration references an un-stubbed managed object, verify can fail with SUPA_VERIFY_FAILED plus SUPA_VERIFY_STUB_REFERENCE.
That failure may be a stub limitation. Confirm by applying the migration to a disposable database that provisions the managed surface, such as a local Supabase stack or preview branch for Supabase projects.
Examples
-
examples/supabasedemonstrates a Supabase-style project layout with one configured declarative tree,supabase/schemas, plus abaseline.sqlbefore-state so the diff runs without a database: -
examples/postgres/schemasdemonstrates a generic PostgreSQL schema tree without Supabase-managed schema rules.

