notiz-dev / prisma-dbml-generator

Prisma DBML Generator
MIT License
684 stars 37 forks source link

feat(dbml): adds Project block to generated dbml file #10

Closed Pirastrino closed 3 years ago

Pirastrino commented 3 years ago

Project block

Ref.: https://github.com/notiz-dev/prisma-dbml-generator/discussions/8#discussion-3286470 Ref.: https://dbdocs.io/docs

Adds optional Project block to the generated schema.dbml which allows users to automate their building process when using dbdocs.io documentation.

Dbdocs build process needs to have a project name specified in the dbml file, otherwise it has to be filled manually on every build.

schema.prisma

generator dbml {
    provider   = "prisma-dbml-generator"
    projectName = "Project Name"
    projectDatabaseType = "PostgreSQL"
    projectNote = "Test project description"
    projectNotePath = "prisma/note.md"
}

note.md

# Project Database
**markdown content here**

schema.dbml

Project Project Name {
  database_type: 'PostgreSQL'
  Note: '''
    # Project Database
    **markdown content here**
  '''
}
marcjulian commented 3 years ago

@Pirastrino thank your for contributing to this package 👍 I have merged your PR and released a dev version.

npm install -D prisma-dbml-generator@0.6.0-dev.0

Please test it out and let me know if it works as expected.

Pirastrino commented 3 years ago

Hi, sorry for the delay. I have tested it and I need to correct the md parser and the project name needs to be in "". I'll fix it later this week.