Merges/postfixes Prisma v2 schemas.
See usage section and examples for more details.
npx prisma-merge-schema \
--datasource ./prisma/src/**/*
--outputFile output.schema
npx prisma-merge-schema \
--datasource ./prisma/src/datasource1.prisma \
--datasource ./prisma/src/datasource2.prisma \
--outputFile output.schema
npx prisma-merge-schema \
--datasource ./prisma/src/datasource.prisma \
--decorators ./prisma/src/decorators.prisma \
--outputFile output.schema
Given a datasource of
model User {
id Int @id
username String @default("") @db.VarChar(1000)
extrafield String @default("") @db.VarChar(1000)
}
and a decorator file of
extends model User {
newfield String @default("") @db.VarChar(1000)
}
replaces model User {
id Int @id @db.UnsignedInt
}
remove model User {
extrafield
}
running
npx prisma-merge-schema \
--datasource ./prisma/src/datasource.prisma \
--decorators ./prisma/src/decorators.prisma \
--outputFile ./prisma/schema.prisma
produces a schema file
model User {
id Int @id @db.UnsignedInt
username String @default("") @db.VarChar(1000)
newfield String @default("") @db.VarChar(1000)
}
Useful for applying changes after prisma introspect
without modifying your original schema.
- Handle automatic deletion of
@@index
annotations
$ npm install -g prisma-merge-schema
$ prisma-merge-schema COMMAND
running command...
$ prisma-merge-schema (-v|--version|version)
prisma-merge-schema/1.0.0 darwin-x64 node-v12.18.2
$ prisma-merge-schema --help [COMMAND]
USAGE
$ prisma-merge-schema COMMAND
...