Registry / database / playbackdb

playbackdb

JSON →
library1.4.27jsnpmunverified

PlaybackDB provides PostgreSQL database schemas and utilities for the Playback health platform. Version 1.4.27 is the latest stable release. It includes schema definitions, migration tooling, and type-safe query builders. Unlike generic ORMs, it is tightly coupled to Playback's domain model and internal conventions. The package is released on an ad-hoc cadence alongside Playback application updates. Key differentiators include built-in support for Playback's multi-tenant architecture and automatic audit logging. It requires Node.js 14+ and pg (node-postgres) as a peer dependency.

npm install playbackdb
INSTALL
IMPORT
SIG · PLAYBACKDB
P
playbackdb
databasejavascriptv1.4.27
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.

installSchema
import { installSchema } from 'playbackdb'
const { installSchema } = require('playbackdb')
ESM-only since v1.0. No CommonJS support.
getMigrationPath
import { getMigrationPath } from 'playbackdb'
import getMigrationPath from 'playbackdb'
Named export, not default export.
SchemaVersion
import type { SchemaVersion } from 'playbackdb'
import { SchemaVersion } from 'playbackdb'
TypeScript type only; do not use at runtime.

Connects to a PostgreSQL database using pg Pool and installs the latest Playback schema via installSchema.

import { installSchema } from 'playbackdb'; import { Pool } from 'pg'; const pool = new Pool({ connectionString: process.env.DATABASE_URL ?? 'postgres://localhost:5432/playback', }); async function setup() { try { const result = await installSchema(pool, { version: 'latest' }); console.log('Schema installed:', result.version); } catch (err) { console.error('Install failed:', err); } finally { await pool.end(); } } setup();
Debug
Known issues
breakinginstallSchema now requires a Pool object; passing a Client will throw.
fix
Replace new Client() with new Pool() and pass the pool instance.
affects: >=1.3.0
deprecatedgetMigrationPath is deprecated. Use getMigrationDir instead.
fix
Replace getMigrationPath with getMigrationDir; it returns a directory path.
affects: >=1.2.0
gotchaSchema migrations are irreversible. Always back up production databases before running installSchema.
fix
Use a separate staging environment to test migrations first.
affects: >=1.0.0
breakingRemoved support for callback-style async operations. Use async/await only.
fix
Refactor any .then() chains to async/await.
affects: >=1.1.0
Errors
Common errors & fixes
TypeError: pool.query is not a function
Passed a Client instance instead of Pool.
fix
Use new Pool() and pass the pool object to installSchema.
Error: no schema version found for latest
The migration directory is empty or missing.
fix
Ensure the node_modules/playbackdb/migrations directory exists and contains valid SQL files.
Cannot find module 'playbackdb'
Package not installed or import path is incorrect.
fix
Run 'npm install playbackdb' and verify the import path.
Upgrade
Version history
1.4.27latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client driver required for runtime schema operations and migrations.
Agent activity
2 hits · last 30 days
node
2
Resources
playbackdb — npm install playbackdb · libregistry