0.2.1 • Published 1 year ago

@cyntheon/prisma-merge v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

prisma-merge

oclif Version Downloads/week License

Until prisma supports multiple schema definition files. See issue #2377

We define our base-file which usually contains your datasource and generator statement and define a glob pattern for our schema files (usually just *.prisma). It will then output a merged version.

We make use of the fact, that all generated schema files in migrations or the generated client are named schema.prisma. So as long as we name our schema files something else and include schema.prisma in our excluded pattern (which is the default), we should be fine. You can also just copy the script and tailor it to your needs. The base & output file are excluded anyways and dont need to be added to the excludedFilePatterns

Install

With yarn

$ yarn add --dev prisma-merge

or npx

$ npx prisma-merge

Options

 -b, --baseFile                    [default: src/prisma/base.prisma] Base file usually with datasource & generator statement
 -s, --schemaFilePatterns          [default: src/**/*.prisma] Glob to all prisma files to include
 -o, --outputFile                  [default: src/prisma/schema.prisma] Output file
 -e, --excludedFilePattern         [default: src/**/schema.prisma] Glob pattern for excluded files (e.g schema.prisma in migrations / generated folder)
 -h, --help                        show CLI help