Registry / database / prego
library0.3.1jsnpmunverified

Prego is a tiny CoffeeScript library for callback-style PostgreSQL database access, migrations, and table associations. Current version is 0.3.1, published as an early development release with no documentation and unstable interfaces. It features reversible SQL migrations executed in transactions, automatic statement preparation via the 'pg' connection pool, a Table base class with snake_case to camelCase conversion, and utility classes for parallel operations. Not recommended for production use due to its alpha state and potential breaking changes.

npm install prego
INSTALL
IMPORT
SIG · PREGO
P
prego
databasejavascriptv0.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

prego
import prego from 'prego'
const prego = require('prego')
ESM named import not available; default import is used.
Table
const { Table } = require('prego')
import { Table } from 'prego'
CommonJS destructuring require is the correct pattern; ESM named export may not exist.
client
prego.client()
prego.client
client is a function that returns a pg client instance; not a property.

Shows configuring Prego, executing a simple query, and creating a migration.

const prego = require('prego'); const pg = require('pg'); // Configure database connection prego.configure({ host: 'localhost', port: 5432, database: 'test', user: process.env.DB_USER ?? 'postgres', password: process.env.DB_PASS ?? '' }); // Execute a query prego.execute('SELECT NOW()', (err, res) => { if (err) throw err; console.log(res.rows[0]); }); // Use a migration prego.migration.create('add_users', 'up', (sql) => { sql(`CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT)`); });
Debug
Known issues
breakingPrego is under early development and interfaces will change drastically. Not ready for any usage.
fix
Avoid using in production; pin exact version and expect breaking changes.
affects: >=0.3.1
Errors
Common errors & fixes
Cannot find module 'prego'
Package not installed or not in node_modules
fix
Run `npm install prego`
prego.configure is not a function
Prego may not have a configure method; version mismatch
fix
Check version; prego.configure may not exist in 0.3.1. Use direct pg pool.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client driver for database connectivity
Agent activity
8 hits · last 30 days
node
6
Resources
packageprego
prego — npm install prego · libregistry