pgm is a simple command-line migration tool for PostgreSQL that only tracks and applies .sql files without generating any SQL. Current stable version is 1.0.8 (last updated 2021). It requires Node 8.2+ and PostgreSQL 9.1+. Key differentiators: no down migrations, no SQL generation, all pending migrations applied in a transaction, supports both JSON and .env configuration, lightweight with minimal dependencies.
npm install pgmNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows setup, configuration, creating a migration, applying it, and checking status using pgm CLI.
Manually write and execute down migrations outside pgm, or use a tool that supports rollbacks.
Ensure each migration filename begins with a unique numeric prefix (e.g., 001, 002).
If you need to change a migration, create a new migration that alters the schema.
Upgrade Node.js to version 8.2 or later.
Use correct env var names: POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, PGM_MIGRATIONS_DIRECTORY, PGM_MIGRATIONS_TABLE.
Start PostgreSQL service (sudo systemctl start postgresql or brew services start postgresql) and verify connection settings in pgm.json or .env.
Update the password field in pgm.json or POSTGRES_PASSWORD in .env. Ensure the PostgreSQL user has the correct password set.
Run pgm up to create the migrations table automatically, or create it manually with SQL.
Do not reuse migration numbers. Use a new sequence number for each migration (e.g., 002).