Best practices for data migrations/historical data changes?

I'm using t3 + Vercel + Planetscale and would like to add a field like user.apiToken as an example. A new field that every user should have pre-generated and ready to use So I need to generate tokens for my existing users. - Prisma migrations are SQL-only by default (right?) so that doesn't play nice - Planetscale doesn't really like Prisma migrations anyway Should I just be making a scripts/ directory and figuring out to run something like that against Vercel? Maybe a temporary API endpoint? What's a good best practice for one-off data migrations like this?
3 Replies
Adam
Adam11mo ago
Hey, did you find a solution for this?
jamiedubs
jamiedubsOP11mo ago
unfortunately not. We're still doing ad-hoc approaches depending on what it is. e.g. sometimes a SQL query (!). sometimes a script with production DB credentials (!!). but whenever possible, a one-off idempotent serverless function kills me since this is such a common workflow and very solved in rails, django, etc
Adam
Adam11mo ago
Ah I see. Thanks for the info :) Yeah, this whole situation is real bummer
Want results from more Discord servers?
Add your server