Schema Forge

Database schema migrations and tooling for your stack.

npm install -g @xubylele/schema-forge

How It Works

Define your schema, run diff, get SQL.

  1. schema.sf

    Your schema in the .sf DSL.

  2. schemaforge diff

    Compare versions and generate migration.

  3. migration.sql

    Apply to your database.

Feature comparison

See how Schema Forge compares to other migration workflows.

DimensionSchema ForgePrismaKnexManual SQL
Schema sourceSingle declarative .sf fileschema.prismaMigrations (up/down) define schemaSQL or ad-hoc DDL
MigrationsGenerates SQL from diff; you applyGenerates + optional apply (Migrate)You write up/down; Knex runs themYou write and run SQL
State / historystate.json + optional live introspectionMigration history table + schemaMigration lock + migration filesYou track it
Query layerNone (schema + SQL only)Full ORM (Prisma Client)Query builderRaw SQL or your layer
Database supportPostgres / SupabaseMany (Postgres, MySQL, SQLite, …)ManyAny
Drift / CIdoctor, validate --url, diff vs live DBmigrate diffNone built-inManual

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.

  1. Init Scaffold project or add to existing.
    npx schema-forge init
  2. Generate Generate migrations from your .sf schema.
    schema-forge generate
  3. 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 workflow

Supabase

Output migrations to Supabase's supabase/migrations/ and run them with the Supabase CLI or dashboard.

Migration workflow

GitHub Actions

Run schema diff and generate in CI with the schema-forge-action. Comment migration SQL on pull requests.

schema-forge-action

VSCode

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 Extension

Products

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 CLI

VSCode 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