Migration File Accidentally Deleted

1. A developer created changes to the prisma.schema file and commited these changes to a supabase database 2. The developer deleted the migration.sql file in the migrations folder before committing it to version control. This file is unrecoverable 3. We are now unable to interact with our database
7 Replies
sam.oriental
sam.oriental2w ago
you can rollback to a prior migration then manually apply a older migration prisma migrate resolve --applied "[migration name]" or you can just manually recreate the migration.sql :joeshrug:
claire_r
claire_rOP2w ago
I get this error when I run resolve --applied: The migration 20241102193309_add_event_model is already recorded as applied in the database. Running into errors there as well
sam.oriental
sam.oriental2w ago
--appleid is if you recreated the sql file to roll back you use --rolled-back (you have to manually reconcile the db to match the state of db at add_event_model) or if you dont gaf about the data in the db just hard reset
sam.oriental
sam.oriental2w ago
https://www.prisma.io/docs/orm/prisma-migrate/workflows/generating-down-migrations this post should be able to help you rebuild that missing sql file
claire_r
claire_rOP2w ago
I'll try that. Thank you
sam.oriental
sam.oriental2w ago
do you play poker?
claire_r
claire_rOP2w ago
No
Want results from more Discord servers?
Add your server