Prisma Markdown
Outline
Prisma markdown documents generator.
- Mermaid ERD diagrams
- Descriptions written by
///
comments - Separations by
@tag
comments
If you want to see how markdown document being generated, read below examples:
Setup
At first, install NPM package.
npm i -D prisma-markdown
At next, add the generator to the schema file.
generator markdown {
provider = "prisma-markdown"
output = "./ERD.md"
}
At last, run below command, than ERD.md file would be generated.
npx prisma generate
@tag
and @erdTag
If your database has over hundreds of models, none of automatic ERD generators can express them perfect. In that case, prisma-migration
recommends you to separate hundreds of models to multiple paginated diagrams by using /// @tags <name>
comments.
When you write /// @tags <name>
comment on models, they would be separated to proper sections of markdown document. For reference, you can assign multiple @tag
s to a model, and if you do not assign any @tag
to a model, it would be assigned to default
tag.
Also, if you use @erdTag
instead of @tag
, target model would be expressed only at ERD. It would not be appeared to the markdown content section.
/// @tag Actors
/// @erdTag Articles
/// @erdTag Orders
/// @erdTag Deposits
model shopping_customers {}
/// @tag Articles
model shopping_questions {}
/// @tag Orders
model shopping_orders {}
/// @tag Deposits
model shopping_deposits {}