A Bun-based TypeScript CLI tool that reads PostgreSQL migration files from disk, applies them sequentially in-memory using @supabase/pg-parser (WASM PostgreSQL 17 parser), and outputs the final schema state as LLM-optimised markdown or JSON. v0.3.0 supports 46 DDL statement types and auto-detects migration tools including Flyway, golang-migrate, goose, dbmate, sql-migrate, Prisma, Drizzle, and Atlas. Unlike existing tools that require a live database connection, this runs purely offline, making it ideal for CI/CD and LLM context injection. Work-in-progress but functionally complete for common DDL patterns.
npm install migration-stateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic CLI usage and programmatic API with table filtering for selective schema output.
Install Bun from https://bun.sh/ and use bunx instead of npx.
Ensure migrations are PostgreSQL-specific. Use --quiet to suppress unknown statement warnings.
Explicitly set --tool option (flyway, golang-migrate, goose, dbmate, sql-migrate, prisma, drizzle, atlas, generic) when ambiguous.
Do not depend on exact JSON shape; validate against expected fields. Pin to exact version if stability is required.
Consider filtering with --tables or --schemas to reduce scope, or run on a per-folder basis.
Install Bun via curl -fsSL https://bun.sh/install | bash or use the official installer.
Specify --tool option explicitly (e.g., --tool generic) or ensure migration files follow a supported naming convention (see README).
Simplify the DDL statement to avoid unsupported syntax, or file an issue on GitHub. Use --quiet to suppress warnings.
Validate SQL syntax (e.g., using psql -c or pg_parse). Strip problematic statements or report to package maintainer.