mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
The last of it, all one shape: sqlite has no enum, so those columns read back as `string`, while hand-written prop and payload types restated the literals. Each now names the type the shim already exports — DownloadType, ViewType — so the column and the code that consumes it stay in step. `linkType` reaches an outgoing webhook, whose contract is a zod enum and should stay strict, so the assertion happens where the payload is built and LINK_TYPES lives with the schema that defines it. DocumentPage.embeddedLinks is the last postgres String[] that became Json; duplicating a document read it back out and wrote it straight into the copy. 99 errors -> 0. Verified from a clean `prisma generate`. Co-authored-by: Hanzo Dev <[email protected]>
Create migrations after changes in schema.prisma
So you have made changes to the schema.prisma file and you want to apply those changes to the database.
Chances are you are getting this error from Prisma after running npx prisma migrate dev:
Drift detected: Your database schema is not in sync with your migration history.
...
Do you want to continue? All data will be lost.
Requirements
- Local prisma
npm install -g prisma
# npx prisma won't work
- shadow database, otherwise you overwrite your local db
Steps
- Create a new migration folder
mkdir -p prisma/migrations/20240408000000_add_model
- Generate the migration
prisma migrate diff --from-migrations prisma/migrations --to-schema-datamodel prisma/schema.prisma --shadow-database-url "postgresql://<USER>@localhost:5432/hanzo-dataroom-shadow-db" --script > prisma/migrations/20240408000000_add_model/migration.sql
- Apply the migration
prisma migrate resolve --applied 20240408000000_add_model