FREEDOM251

Freedom251 › Database Migration Tools

node-pg-migrate

Free plan APISelf-hosted

Visit node-pg-migrate Alternatives

node-pg-migrate's own site

What node-pg-migrate is

node-pg-migrate is a free, open-source tool for managing PostgreSQL database migrations. You can write migrations in JavaScript, TypeScript, or SQL, then run them from command-line commands or through a programmatic runner API. Its pgm API covers tables, indexes, functions, triggers, policies, roles, extensions, grants, and other PostgreSQL objects. Pending migrations run in one transaction by default under an advisory lock, while an order check rejects out-of-sequence migrations. The up --dry-run option prints the SQL a run would execute without applying it, using a read-only transaction. Reversible operations can provide inferred down migrations when a migration omits a down function. Installation is available through npm, pnpm, yarn, or bun and adds a runnable file to node_modules/.bin. Documented prerequisites are Node.js 22.12.0 or higher and PostgreSQL 14 or higher; lower PostgreSQL versions are not officially supported. The project targets PostgreSQL and has also been tested with CockroachDB. It is released under the MIT License and offers a self-hosted option.

Who it suits

It suits developers and teams managing PostgreSQL schema changes in JavaScript, TypeScript, or SQL. It is also suited to self-hosted deployments that need transaction, locking, dry-run, and rollback controls.

What it does well

  • Supports JavaScript, TypeScript, and SQL migrations
  • Dry runs print SQL without applying changes
  • Pending migrations use transactions and advisory locks
  • Rollback migrations can be inferred for reversible operations
  • Covers many PostgreSQL database objects

What to know first

  • Targets PostgreSQL rather than multiple database systems
  • Requires Node.js 22.12.0 or higher
  • PostgreSQL versions below 14 are unsupported
  • The pg library may need separate installation

Verdict

node-pg-migrate provides a focused PostgreSQL migration workflow with several deployment safeguards. Its language options, dry runs, locking, and rollback support suit teams that meet the documented runtime and database requirements.

Facts from node-pg-migrate's own pages

Automatic rollback
Reversible operations can infer down migrations when a migration omits a down function. · salsita.github.io, 4 Oct 2026
Database requirement
The project documents PostgreSQL 14 or higher as a precondition; lower versions may work but are not officially supported. · salsita.github.io, 4 Oct 2026
Database scope
The project says it targets PostgreSQL and has also been tested with CockroachDB. · github.com, 11 Oct 2026
Dependency
The getting-started guide says to install the pg library if it is not already present. · salsita.github.io, 11 Oct 2026
Deployment safeguards
Pending migrations run in one transaction under an advisory lock, and an order check rejects out-of-sequence migrations. · salsita.github.io, 4 Oct 2026
Distribution
The project is released under the MIT License. · github.com, 11 Oct 2026
Dry runs
The CLI's up --dry-run prints the SQL without applying it and runs in a read-only transaction. · salsita.github.io, 4 Oct 2026
Dry-run safety
Dry runs use a read-only database transaction and apply none of the migration SQL. · salsita.github.io, 11 Oct 2026
Execution
Migrations can be run from the command line or through the programmatic runner API. · salsita.github.io, 11 Oct 2026
Generated SQL
The tool can print the SQL a real run would execute with the --dry-run option. · salsita.github.io, 11 Oct 2026
Installation
The package can be installed with npm, pnpm, yarn, or bun and adds a runnable file to node_modules/.bin. · salsita.github.io, 4 Oct 2026
Interfaces
Migrations can be run with CLI commands or through the programmatic runner API. · salsita.github.io, 4 Oct 2026
License
The project is released under the MIT License. · salsita.github.io, 4 Oct 2026
Limit
The project says it only targets PostgreSQL, rather than supporting multiple database systems. · salsita.github.io, 11 Oct 2026
Maker
The repository lists Salsita Software among the project's former maintainers. · github.com, 4 Oct 2026
Maker background
Salsita says it was founded in Prague in 2010 and lists its headquarters in Prague, Czechia. · salsita.ai, 4 Oct 2026
Migration languages
Migrations can be written in JavaScript, TypeScript, or SQL. · salsita.github.io, 11 Oct 2026
PostgreSQL coverage
The pgm API includes operations for database objects such as tables, indexes, functions, triggers, policies, roles, and extensions. · salsita.github.io, 11 Oct 2026
PostgreSQL operations
The pgm API includes operations for tables, indexes, functions, triggers, policies, roles, extensions, grants, and other PostgreSQL objects. · salsita.github.io, 4 Oct 2026
Purpose
node-pg-migrate manages database migrations for PostgreSQL from Node.js. · github.com, 11 Oct 2026
Requirements
The documented prerequisites are Node.js 22.12.0 or higher and PostgreSQL 14 or higher; lower PostgreSQL versions are not officially supported. · salsita.github.io, 11 Oct 2026
Rollback
Reversible operations can have their down migrations inferred when a migration omits down. · salsita.github.io, 11 Oct 2026
Runtime requirement
The project documents Node.js 22 or higher as a precondition. · salsita.github.io, 4 Oct 2026
Support and contributions
The repository welcomes contributors, and the documentation links to troubleshooting guidance. · github.com, 11 Oct 2026

Where node-pg-migrate stands on Freedom251

Look at these too