how to add a column to my database in production without wiping database (prisma x mysql)

I want to add a column to my current user table I want to add a column called verified and defaults to false But we are currently in production with large users i can't afford data lose any ideas?
3 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Lopen
LopenOP•2y ago
Prisma docs on this is actually very confusing but i figured it out though 1. Create a new dummy database so you can generate a new migration on it 2. Go to your production database and delete everything in _prisma_migration 3. Delete everything in your migration folder on your project 4. Connect to your dummy database and run the command npx prisma migrate dev --name init_state 5. While still connected to your dummy database edit you scheme.prisma and all the changes you want then run the command npx prisma migrate dev --name add_new_things 6. Connect back to your production database and run npx prisma migrate resolve --applied the_name_of_the_migration_folder_applied_before this is to mark all the migrations you have applied before 7. Finally run npx prisma migrate deploy this will apply the latest migrations yet to be applied Does it also affect it if i use PostgreSQL? When you say job can't i do it in prisma and maybe do it in loop inside a seed file? 🤔 So i do something like Prisma.user.findmany() Then loop through all and update them accordingly? Also how bad is the performance issue Because i have actually done that in production and gone live already
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server