prisma-generator-plantuml-erd v1.4.0
prisma-generator-plantuml-erd
Prisma generator to create an ER Diagram for plantuml.
You can generate the plantuml source code from the schema.prisma.
example
schema.prisma
- generated plantuml file
- generated image file
usage
npm i -D prisma-generator-plantuml-erd
# or
yarn add -D prisma-generator-plantuml-erd
Add to your schema.prisma
generator erd_plantuml {
provider = "prisma-generator-plantuml-erd"
output = "erd.puml"
}
Run the generator
$ npx prisma generate
Versions
This generator only support prisma3. If you use the version greater than 4, this plugin is not work.
Options
output
The path of generated plantuml file path. The default value is './erd.puml'
usePhysicalTableName
If this flag is true, physical table name is used for name of table on er diagram. The default value is false;
model User {
id String @id
@map("users")
}
If this flag is set to true, then "users" will be displayed on the diagram, otherwise "User" is displayed on the diagram.
exportPerTables
If this flag is true, generate some tables If this flag is true, it also generate some diargrams that based on each table. The diagrams is rendered with only the tables that related with base table. The default value is false.
example
- all tables
- related with User table
related with Team table
lineLength
You can change the length of relation line by this option. The default value is '--'.
In the default case
Table1 }o--o| Table3
if you set this flag to '---'
Table1 }o---o| Table3
showUniqueKeyLabel
If this flag is true, unique column is also labeled as unique key on er diagram, like [UK]
.
The default value is false.
markdownOutput
If this flag is set, a markdown table definition will be generated as well.
example
markdownIncludeERD
If this flag is true, an ER diagram for each table is generated on the table definitions The default value is false.
asciidocOutput
If this flag is set, a asciidoc table definition will be generated as well.
example
asciidocIncludeERD
If this flag is true, an ER diagram for each table is generated on the table definitions The default value is false.
Example
The example config is here.
generator erd_plantuml {
output = "path/to/output.puml"
lineLength = "----"
exportPerTables = true
usePhysicalTableName = false
showUniqueKeyLabel = true
markdownOutput = "./example-tables.md"
markdownIncludeERD = true
asciidocOutput = "./example-tables.adoc"
asciidocIncludeERD = true
}