A PostgreSQL adapter for Fortune.js that maps Fortune's data interface directly to SQL statements without ORM overhead. Supports non-destructive table setup, array foreign keys for performance, and optimized query building. Current stable version is 1.6.11, last updated in 2020 with sporadic maintenance. Requires PostgreSQL 9.4+. Unlike ORM-based adapters, it delegates foreign key enforcement to Fortune.js and avoids junction tables by using array columns. The adapter also exposes the underlying pg-pool for raw queries. Release cadence is low; no major changes expected.
npm install fortune-postgresNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up Fortune.js with the Postgres adapter, define a simple schema, and perform create/find operations.
Upgrade Node to version 10 or higher.
Manually alter tables using SQL or a migration tool.
Use `useForeignKeys: true` in options to enable FK constraints on non-array fields, but note it adds overhead.
Provide custom `generatePrimaryKey` function or use UUIDs.
Add `?ssl=true` to URL or set `ssl: true` in connection object.
Run `npm install fortune-postgres` and ensure it's in dependencies.
Use `adapter: [postgresAdapter, { url: '...' }]`.Ensure PostgreSQL is running and connection URL is correct.
Ensure `store.connect()` is called before accessing pool.