Drizzle Docs Generator is a CLI tool that simplifies the process of generating DBML from Drizzle ORM schemas. By extracting JSDoc comments and converting them to DBML Notes, it enhances documentation and supports various features like directory imports and watch mode for automatic regeneration.
The drizzle-docs-generator is a powerful CLI tool designed for developers working with Drizzle ORM. It enables seamless generation of DBML (Database Markup Language) from ORM schemas, making database documentation straightforward and efficient.
import { users } from './users').relations() or defineRelations(), facilitating comprehensive relationship mapping within your database.This tool is easy to use, with commands like:
# Basic usage for a single file
$ drizzle-docs generate ./src/db/schema.ts -d postgresql
# Importing all schema files from a directory
$ drizzle-docs generate ./src/db/schema/ -d postgresql
# Output DBML to a specific file
$ drizzle-docs generate ./src/db/schema.ts -d postgresql -o schema.dbml
# Generate using relations definitions
$ drizzle-docs generate ./src/db/schema.ts -d postgresql -r
# Enable watch mode for auto-regeneration on changes
$ drizzle-docs generate ./src/db/schema.ts -d postgresql -w
The tool can also be integrated into applications using the following API:
import { pgGenerate } from "drizzle-docs-generator";
import * as schema from "./schema";
const dbml = pgGenerate({
schema,
source: "./schema.ts",
relational: false,
out: "./output.dbml", // optional
});
package.json).This tool streamlines the process of generating database documentation, enhancing the development workflow and ensuring that schemas are clearly represented and easily maintainable.
No comments yet.
Sign in to be the first to comment.