sequelize-pg-utilities is an opinionated set of database utilities designed to simplify the configuration and connection process for PostgreSQL databases when used with Sequelize or the Sequelize CLI. It standardizes database configuration by integrating values from config files, environment variables, and sensible defaults, and also provides a mechanism for creating the database itself. The current stable version is 2.0.2, with recent updates focused on dependency upgrades and maintenance. The library differentiates itself by addressing the configuration discrepancies between Sequelize and the Sequelize CLI and offering built-in database creation capabilities, abstracting away common setup complexities for PostgreSQL users. Releases typically occur as needed for dependency updates, bug fixes, or significant API changes.
npm install sequelize-pg-utilitiesVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `sequelize-pg-utilities` to configure and connect to a PostgreSQL database with Sequelize, including handling environment variables and illustrating database creation.
Remove `operatorsAliases` from your Sequelize configuration. For deprecated operators, use the new symbol-based operators introduced in Sequelize v5+ (e.g., `Op.eq` instead of `$eq`).
Ensure `pg` is installed as a direct dependency in your project: `npm install pg` or `yarn add pg`.
Update any code accessing the 'is new database' flag to use `dbNew` instead of `isNew` from the `configure` function's return object.
Always use `require()` for importing this package's utilities in CommonJS environments. For ESM projects, ensure your build system or Node.js environment is configured to correctly handle CommonJS modules, or consider using dynamic `import()` if static `import` fails.
Install 'pg' as a direct dependency: `npm install pg` or `yarn add pg`.
Double-check your `config.json` and environment variables. Ensure `configure(config)` receives a valid object and that the resulting `options` object is properly structured before passing to `new Sequelize()`.
Replace all instances of `isNew` with `dbNew` in your code, as the property name was standardized in v2.0.0.