diff, check, types, migrations, and sync commands, supaschema ships a set of utility commands for scripting, introspection, diagnostics, and shell integration. Each command is documented below. All of them accept --config <path> to point at a non-default config file.
plan — Print the diff plan as JSON
plan — Print the diff plan as JSON
plan runs the same schema comparison logic as diff but instead of writing a migration file it prints the full object-level diff plan to stdout as JSON. Use it to drive custom tooling, feed a review script, or inspect exactly what supaschema intends to generate before you commit to a migration.objects array. Each element describes a single DDL object, the operation (create, alter, drop), and the ordered list of SQL statements that would be emitted.Flags: --from <source>, --to <target>, --schema <names>, --timing.inspect — Print the schema model as JSON
inspect — Print the schema model as JSON
inspect extracts the full in-memory schema model for any supported source and prints it as formatted JSON. The model is the same intermediate representation that every other supaschema command operates on, so this is the fastest way to understand what supaschema sees when it reads a given source.unsupported array.Flags: --from <source> (defaults to the config schema tree), --schema <names> (comma-separated filter).fingerprint — Print the model equality hash
fingerprint — Print the model equality hash
fingerprint computes the canonical hash of a source’s schema model and prints it to stdout. Two sources with identical fingerprints have identical schemas from supaschema’s perspective, regardless of formatting or comment differences in the underlying SQL files.--from <source> (required).audit — Report schema coverage
audit — Report schema coverage
audit reads a schema source and produces a coverage report showing which DDL objects supaschema’s diff engine fully supports, partially supports, or does not yet support. Use it to understand which parts of your schema will be managed by supaschema and which parts you must continue to manage manually.unsupported category are passed through verbatim in generated migrations rather than being diff-managed.Flags: --from <source> (required), --json.corpus — Run the corpus oracle
corpus — Run the corpus oracle
corpus replays a directory of real-world migration files (the corpus), diffs each against its declared schema tree, applies the rendered reconciliation migration twice, and requires the re-diff to converge to zero operations. It is the regression oracle that proves supaschema’s diff engine handles complex, real-world schemas correctly.--corpus-dir <dir> (default: corpus/supabase-style), --database-url <url>, --json.corpus creates and drops databases on the target server. The role must have CREATEDB privileges, and the target should be a local or intentionally disposable instance.doctor — Diagnose your environment
doctor — Diagnose your environment
doctor checks every component of your supaschema setup and reports a pass/fail result for each. Run it first whenever you set up supaschema in a new environment, or whenever something behaves unexpectedly.doctor checks the following, in order:| Check | What it verifies |
|---|---|
| Node version | Your Node.js version meets the minimum requirement |
| Parser | The SQL parser module loaded correctly |
| Config file | supaschema.config.json is present, valid JSON, and passes schema validation |
| Database URL | A URL is resolvable from flags, environment variables, or config |
| Reachability | The database accepts TCP connections |
| Auth | The supplied credentials authenticate successfully |
CREATEDB | The connecting role has CREATEDB (required for some operations) |
| Migrations history | The history table exists and is queryable |
| Declarative tree | The schemaPaths directories exist and contain parseable SQL files |
init — Write a default config file
init — Write a default config file
init writes a supaschema.config.json file with sensible defaults into the current working directory. If a config file already exists, the command exits with an error rather than overwriting it.diff.completion — Print shell completion script
completion — Print shell completion script
completion prints a shell completion script for the shell you specify. Source it or append it to your shell’s startup file to get tab-completion for all supaschema commands, flags, and source specifiers.source ~/.bashrc, exec zsh, or open a new terminal) for completions to take effect. Supported shells: bash, zsh, fish.If you install supaschema globally (
npm install -g supaschema) rather than via npx, replace npx supaschema completion with supaschema completion in the commands above.explain — Look up a diagnostic code
explain — Look up a diagnostic code
explain prints a full offline description of any SUPA_* diagnostic code: what it means, what conditions trigger it, and how to resolve it. You never need a network connection or a browser to look up an error.- A plain-English description of the condition
- The command(s) that can emit the code
- Common causes
- Recommended remediation steps
- Links to relevant sections of this documentation (printed as URLs for offline use)
selfcheck — Engine parity check
selfcheck — Engine parity check
selfcheck connects to a live database, re-extracts the catalog using supaschema’s extraction pipeline, then reports any object whose round-trip SQL representation doesn’t match what the engine would produce. It reveals normalization gaps — places where supaschema’s model of an object differs from the live catalog.selfcheck is primarily useful when you are evaluating supaschema against an existing database that was not created with supaschema, or when you want to verify that upgrading supaschema hasn’t changed how it models any of your existing objects.Flags: --database-url <url> (defaults to SUPASCHEMA_DATABASE_URL or the local Supabase stack).