Organize database schema
Ayush Sharma
Another short improvement: The core schema of achromatic boilerplate should sit in a different file like core.ts instead of schema.ts and The schema.ts should re-export core.ts contents.
This small change will make rebasing changes a lot easier as I can just create a new file for my own business logic schema and import it inside schema.ts without making the whole boilerplate schema dirty.
S
Steve O.
Instructions for using multiple schema files in Prisma
In
/packages/database/package.json
, add: "prisma": {
"schema": "./prisma/schema.prisma"
}
In
/packages/database/prisma/schema.prisma:
generator client {
provider = "prisma-client-js"
previewFeatures = ["prismaSchemaFolder"]
}
You can now add other
.prisma
files in the prisma
folder and they will be taken into account.Ayush Sharma
This is in reference to drizzle monorepo.
S
Steve O.
Ayush Sharma same for Prisma, I would prefer not to see my product's tables mixed with the core ones. There could be a
core.schema
file and a prisma.schema
with the Contact* tables since it's the demo product.