Registry / devops / tablerizer

tablerizer

JSON →
library3.0.1jsnpmunverified

Tablerizer (v3.0.1) is a PostgreSQL table export wizard that generates SQL files for recreating table privileges (RBAC), Row-Level Security (RLS) policies, triggers, constraints, and schema documentation. It supports multi-schema exports, role mapping with placeholders, idempotent scripts with cleanup sections, and can export both tables and stored procedures/functions. It is designed for database migrations, environment synchronization, and integration with Graphile Migrate. The tool offers a CLI and a TypeScript library, with flexible configuration via CLI args, config files, or environment variables. Node.js >=18.0.0 required.

npm install tablerizer
INSTALL
IMPORT
SIG · TABLERIZER
T
tablerizer
devopsjavascriptv3.0.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.

Tablerizer
✓ import { Tablerizer } from 'tablerizer'
✗ import Tablerizer from 'tablerizer'
Named export, not default. Requires ESM or TypeScript with module resolution supporting named exports.
exportTables
✓ import { exportTables } from 'tablerizer'
✗ const { exportTables } = require('tablerizer')
Package is ESM-only (type: module in package.json). CommonJS require() will fail.
exportFunctions
✓ import { exportFunctions } from 'tablerizer'
✗ import { exportFunctions } from 'tablerizer/exportFunctions'
Single entrypoint; do not use subpath imports.

Demonstrates exporting tables and functions with role mapping and progress output via the library API.

import { exportTables } from 'tablerizer'; const result = await exportTables({ schemas: ['app_public'], database_url: process.env.DATABASE_URL ?? '', out: './exports', scope: 'all', roles: ['admin', 'user'], role_mappings: { myapp_admin: ':DATABASE_ADMIN', myapp_user: ':DATABASE_USER', }, }); console.log(`Exported ${result.totalFiles} files (${result.tableFiles} tables, ${result.functionFiles} functions)`);
Debug
Known issues
breakingNode.js >=18.0.0 is required. Using older versions will result in runtime errors due to ESM and newer APIs.
fix
Upgrade Node.js to v18 or later.
affects: <18.0.0
breakingESM-only: Package uses ES modules. CommonJS require() will throw ERR_REQUIRE_ESM.
fix
Use import statements instead of require(). If your project uses CommonJS, consider dynamic import().
affects: >=3.0.0
breakingTypeScript peer dependency ^6.0.3: Using an older TypeScript version may cause type errors.
fix
Install TypeScript ^6.0.3 or adjust your tsconfig.json to use skipLibCheck.
affects: >=3.0.0
gotchaDatabase connection requires a valid DATABASE_URL. The library may hang or throw cryptic errors if the connection fails.
fix
Verify that DATABASE_URL is set and the PostgreSQL server is reachable.
affects: >=3.0.0
gotchaRole mappings are case-sensitive. Incorrect casing will result in no replacement of placeholders.
fix
Ensure role_mappings keys match exactly the roles returned by PostgreSQL.
affects: >=3.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /path/to/node_modules/tablerizer/dist/index.js
Using require() to import an ESM-only package.
fix
Change to import { Tablerizer } from 'tablerizer' or use dynamic import.
TypeError: tablerizer.export is not a function
Calling export() on a Tablerizer instance before connecting or after disconnect().
fix
Ensure the instance is created and connected, then call export(). Do not reuse after disconnect().
error: role "myapp_admin" does not exist
The role specified in roles does not exist on the PostgreSQL server, or role_mappings key does not match.
fix
List existing roles with `\du` in psql and match the role name exactly in roles array.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
typescriptoptionalPeer dependency: requires TypeScript ^6.0.3 for development/type checking
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
tablerizer — npm install tablerizer · libregistry