prisma-erd-generator-markdown

1.3.1 • Public • Published

Prisma ERD Generator Markdown

Prisma generator to create a mermaid ERD in a markdown file.

Install

npm i -D prisma-erd-generator-markdown
# or
yarn add -D prisma-erd-generator-markdown

Setup

Add to your schema.prisma

generator erd {
  provider = "prisma-erd-generator-markdown"
  output   = "./ERD.md"
}

Generate

Run the generator

npx prisma generate

Example

Given the following prisma schema:

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}


model Post {
  id        Int     @id @default(autoincrement())
  title     String
  content   String?
  published Boolean @default(false)
  author    User    @relation(fields: [authorId], references: [id])
  authorId  Int
}

This diagram will be generated:

erDiagram
	User {
		Int id PK  "autoincrement()"
		String email
		String name  "nullable"
	}
	Post {
		Int id PK  "autoincrement()"
		String title
		String content  "nullable"
		Boolean published
		Int authorId FK
	}
	Post }o--|| User : author

This generator was bootstraped using create-prisma-generator

Package Sidebar

Install

npm i prisma-erd-generator-markdown

Weekly Downloads

173

Version

1.3.1

License

MIT

Unpacked Size

16.6 kB

Total Files

14

Last publish

Collaborators

  • w3cj