prisma-merge
v0.2.0
Published
Merge prisma schema files
Downloads
4,553
Readme
prisma-merge
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 global add prisma-merge
or npx
$ npx prisma-merge
Options
-b, --baseFilePattern [default: src/**/*.base.prisma] Base file (can be glob), usually with datasource & generator statement
-e, --excludedFilePatterns [default: src/**/schema.prisma] Glob patterns for excluded files (e.g schema.prisma in migrations / generated folder)
-o, --outputFile [default: src/prisma/schema.prisma] Output file
-s, --schemaFilePatterns [default: src/**/*.prisma] Glob to all prisma files to include
-h, --help show CLI help