Schema Forge
Database schema migrations and tooling for your stack.
npm install -g @xubylele/schema-forgeHow It Works
Define your schema, run diff, get SQL.
schema.sfYour schema in the .sf DSL.
schemaforge diffCompare versions and generate migration.
migration.sqlApply to your database.
Feature comparison
See how Schema Forge compares to other migration workflows.
| Dimension | Schema Forge | Prisma | Knex | Manual SQL |
|---|---|---|---|---|
| Schema source | Single declarative .sf file | schema.prisma | Migrations (up/down) define schema | SQL or ad-hoc DDL |
| Migrations | Generates SQL from diff; you apply | Generates + optional apply (Migrate) | You write up/down; Knex runs them | You write and run SQL |
| State / history | state.json + optional live introspection | Migration history table + schema | Migration lock + migration files | You track it |
| Query layer | None (schema + SQL only) | Full ORM (Prisma Client) | Query builder | Raw SQL or your layer |
| Database support | Postgres / Supabase | Many (Postgres, MySQL, SQLite, …) | Many | Any |
| Drift / CI | doctor, validate --url, diff vs live DB | migrate diff | None built-in | Manual |
Ideal when you want a single schema source and plain SQL migrations without an ORM.
Install & Quickstart
Run without installing globally via npx, or install globally and use the same commands.
- Init —Scaffold project or add to existing.
npx schema-forge init - Generate —Generate migrations from your .sf schema.
schema-forge generate - Diff —Compare schema versions and show SQL diff.
schema-forge diff
Integrations
PostgreSQL
Schema Forge generates PostgreSQL-compatible SQL. Use with any Postgres database or migration runner.
Migration workflowSupabase
Output migrations to Supabase's supabase/migrations/ and run them with the Supabase CLI or dashboard.
Migration workflowGitHub Actions
Run schema diff and generate in CI with the schema-forge-action. Comment migration SQL on pull requests.
schema-forge-actionVSCode
Official extension (0.4.x): Visual Diff, status bar menu, diagnostics, hover docs, completion, and Command Palette actions (Init, Generate, Diff, Preview SQL). Requires VS Code 1.70+ (RLS).
VSCode ExtensionProducts
schema-forge-core
Deterministic engine that parses the .sf DSL, diffs schema versions, and generates SQL. Framework-agnostic; powers the CLI and VSCode extension.
Core (npm)schema-forge CLI
Terminal workflow: init, generate, diff, validate. Tracks state and outputs migrations; CI-friendly exit codes.
Install CLIVSCode Extension
Editor support for .sf: Visual Diff, status bar, diagnostics, hover docs, quick fixes, and Command Palette actions (Init, Generate, Diff, Preview SQL). Requires VS Code 1.70+ (RLS).
VSCode Extension