{"id":44024,"library":"tablerizer","title":"Tablerizer","description":"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.","status":"active","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/GRINN-dev/tablerizer","tags":["javascript","postgresql","rbac","rls","row-level-security","database","privileges","sql","migration","typescript"],"install":[{"cmd":"npm install tablerizer","lang":"bash","label":"npm"},{"cmd":"yarn add tablerizer","lang":"bash","label":"yarn"},{"cmd":"pnpm add tablerizer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: requires TypeScript ^6.0.3 for development/type checking","package":"typescript","optional":true}],"imports":[{"note":"Named export, not default. Requires ESM or TypeScript with module resolution supporting named exports.","wrong":"import Tablerizer from 'tablerizer'","symbol":"Tablerizer","correct":"import { Tablerizer } from 'tablerizer'"},{"note":"Package is ESM-only (type: module in package.json). CommonJS require() will fail.","wrong":"const { exportTables } = require('tablerizer')","symbol":"exportTables","correct":"import { exportTables } from 'tablerizer'"},{"note":"Single entrypoint; do not use subpath imports.","wrong":"import { exportFunctions } from 'tablerizer/exportFunctions'","symbol":"exportFunctions","correct":"import { exportFunctions } from 'tablerizer'"}],"quickstart":{"code":"import { exportTables } from 'tablerizer';\n\nconst result = await exportTables({\n  schemas: ['app_public'],\n  database_url: process.env.DATABASE_URL ?? '',\n  out: './exports',\n  scope: 'all',\n  roles: ['admin', 'user'],\n  role_mappings: {\n    myapp_admin: ':DATABASE_ADMIN',\n    myapp_user: ':DATABASE_USER',\n  },\n});\n\nconsole.log(`Exported ${result.totalFiles} files (${result.tableFiles} tables, ${result.functionFiles} functions)`);","lang":"typescript","description":"Demonstrates exporting tables and functions with role mapping and progress output via the library API."},"warnings":[{"fix":"Upgrade Node.js to v18 or later.","message":"Node.js >=18.0.0 is required. Using older versions will result in runtime errors due to ESM and newer APIs.","severity":"breaking","affected_versions":"<18.0.0"},{"fix":"Use import statements instead of require(). If your project uses CommonJS, consider dynamic import().","message":"ESM-only: Package uses ES modules. CommonJS require() will throw ERR_REQUIRE_ESM.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Install TypeScript ^6.0.3 or adjust your tsconfig.json to use skipLibCheck.","message":"TypeScript peer dependency ^6.0.3: Using an older TypeScript version may cause type errors.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Verify that DATABASE_URL is set and the PostgreSQL server is reachable.","message":"Database connection requires a valid DATABASE_URL. The library may hang or throw cryptic errors if the connection fails.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Ensure role_mappings keys match exactly the roles returned by PostgreSQL.","message":"Role mappings are case-sensitive. Incorrect casing will result in no replacement of placeholders.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'18.0.0':87 'arg':80 'cleanup':43 'cli':70,79 'config':81 'configur':77 'constraint':26 'databas':57,97 'design':55 'document':29 'environ':59,84 'export':8,35,47 'file':13,82 'flexibl':76 'generat':11 'graphil':64 'idempot':40 'integr':62 'javascript':89 'level':21,95 'librari':74 'map':37 'migrat':58,65,100 'multi':33 'multi-schema':32 'node.js':86 'offer':68 'placehold':39 'polici':24 'postgresql':6,90 'privileg':17,98 'procedures/functions':52 'rbac':18,91 'recreat':15 'requir':88 'rls':23,92 'role':36 'row':20,94 'row-level':19 'row-level-secur':93 'schema':28,34 'script':41 'section':44 'secur':22,96 'sql':12,99 'store':51 'support':31 'synchron':60 'tabl':7,16,49 'tabler':1,2 'tool':67 'trigger':25 'typescript':73,101 'v3.0.1':3 'variabl':85 'via':78 'wizard':9","created_at":"2026-06-05T17:02:36.495247+00:00","updated_at":"2026-06-05T17:02:36.495247+00:00","problems":[{"fix":"Change to import { Tablerizer } from 'tablerizer' or use dynamic import.","cause":"Using require() to import an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /path/to/node_modules/tablerizer/dist/index.js"},{"fix":"Ensure the instance is created and connected, then call export(). Do not reuse after disconnect().","cause":"Calling export() on a Tablerizer instance before connecting or after disconnect().","error":"TypeError: tablerizer.export is not a function"},{"fix":"List existing roles with `\\du` in psql and match the role name exactly in roles array.","cause":"The role specified in roles does not exist on the PostgreSQL server, or role_mappings key does not match.","error":"error: role \"myapp_admin\" does not exist"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/GRINN-dev/tablerizer#readme","github":"https://github.com/GRINN-dev/tablerizer","docs":null,"changelog":null,"pypi":null,"npm":"tablerizer","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}