traches
TTCTheo's Typesafe Cult
•Created by traches on 10/20/2023 in #questions
Drizzle & Planetscale data migration workflow
I over-abstracted and added an association where I really only needed a boolean. Updating the schema is easy enough with db:push, but I also need to update all the existing records in prod - set new boolean column to the value of whatever the association is. That’s where my trouble was.
7 replies
TTCTheo's Typesafe Cult
•Created by traches on 10/20/2023 in #questions
Drizzle & Planetscale data migration workflow
Update: I figured out a workaround:
- Make a random schema change
- run
drizzle-kit generate
, and since drizzle thinks a schema change is needed it will actually generate a SQL file
- Discard said schema change
- Replace generated SQL with whatever UPDATE statements I need
- call drizzle's provided migrator function as appropriate
- success
Pretty sure ignoring the --custom
flag is a bug, though. I've got an issue open on drizzle-kit's github about it (dont dox me pls)7 replies