Skip to content
Vivek edited this page Jul 14, 2026 · 4 revisions

@schema-weaver/migration-engine

PostgreSQL schema introspection, diff, DDL generation, and safe migration execution.

Quick Links

Topic Description
Architecture 7-layer engine design and data flow
Supported-Objects Full 37 object types with coverage %
API-Reference All public methods with parameters
Safe-Migration-Patterns 3-step patterns for safe migrations
Risk-Assessment 5-level risk classification system
PG-Version-Matrix Feature support across PG10-18
Testing 6-layer test strategy and results

Why This Engine

No existing open-source tool covers 37 PostgreSQL object types:

Tool Coverage Limitation
pgAdmin UI only No programmatic API
Atlas ~15 types Missing views, functions, triggers, policies
Prisma ~10 types Ignores behavioral objects

This engine: 37 types, 98.5% property coverage

Installation

npm install @schema-weaver/migration-engine pg

Quick Start

import pg from 'pg';
import { SwMigrationEngine } from '@schema-weaver/migration-engine';

const pool = new pg.Pool({ host: 'localhost', database: 'mydb' });
const engine = new SwMigrationEngine();

const snapshot = await engine.introspect(pool);
const diff = engine.diff(desired, snapshot);
const plan = engine.plan(diff);

if (!plan.blocked) {
  await engine.execute(pool, plan);
}

License

Business Source License 1.1 (BSL) — free for development, commercial license required for production.

Built by Schema Weaver — the AI-native PostgreSQL workspace for developers.

Clone this wiki locally