PostgreSQL migration strategy for NodeJS that provides APIs to diff and migrate PostgreSQL schemas and data. Version 1.5.3, released under MIT license. It offers programmatic schema comparison and migration generation, unlike CLI-based alternatives. Features include comparison of database schemas, generation of migration scripts, and support for complex schema objects. Suitable for Node.js >= 8.11.1. Active maintenance with recent releases.
npm install pg-diff-apiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to two PostgreSQL databases, compares their schemas, and generates a migration SQL script.
Update to use async/await or .then() syntax.
Pass a pg Client object instead of a connection string.
Ensure you pass a different target client (even if same database, create a new connection).
Update code to handle object with properties like 'tables', 'columns', etc.
Use 'import { PgDiffApi } from 'pg-diff-api'' instead of 'import PgDiffApi from ...'Run 'npm install pg' and ensure it's the correct version (compatible with pg-diff-api).
Create a new Client object and connect before passing to PgDiffApi.