pg-flyway is a Node.js-based migration tool for PostgreSQL that mirrors the Flyway pattern without wrapping the Java or CLI version. The current stable version is 1.3.2, with frequent minor updates. It supports creating, migrating, and tracking SQL migrations with a dedicated history table. Unlike db-migrate or node-pg-migrate, pg-flyway emphasizes Flyway-like naming conventions, versioned migrations, and a CLI-first approach. It ships TypeScript definitions and requires Node.js >=14.
npm install pg-flywayNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize PgFlyway with database URL and migration directory, then run migrations and display info.
Add "type": "module" to package.json or use .mjs file extension.
Name files as V1__Init.sql or V202501151755__Init.sql (date format).
Specify custom historyTable in options.
Append ?schema=your_schema to the URL.
Use import (ESM) and ensure Node.js >=14 with "type": "module".
Rename to V1__Init.sql or similar.
Start Docker container or check DATABASE_URL.