Converts Drizzle ORM schema definitions into DBML (Database Markup Language) markup for visual database design and documentation. Currently at version 0.10.0, this package supports all Drizzle dialects (PostgreSQL, MySQL, SQLite) and generates table definitions with columns, primary keys, foreign keys, unique constraints, indexes, and relations. It requires drizzle-orm >=0.36.0 and tsx for execution. Unlike manual DBML editing, this generator ensures your schema documentation stays in sync with your code. Ships TypeScript types.
npm install drizzle-dbml-generatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to generate a DBML file from a Drizzle ORM schema using a script executed with tsx.
Upgrade drizzle-orm to version 0.36.0 or higher.
Avoid using `relational: false`; if needed, continue using it but be aware it may break.
Define your schema using Drizzle ORM's pgTable, mysqlTable, etc. and export it as a single object.
Use ESM imports in your script or configure tsx to handle TypeScript correctly.
Run: npm install -D drizzle-dbml-generator
Update to version >=0.10.0: npm install -D drizzle-dbml-generator@latest
Change to ESM import: import { pgGenerate } from 'drizzle-dbml-generator';