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
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:
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--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
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
Generating down migrations | Prisma Documentation
How to generate down migrations
I'll try that. Thank you
do you play poker?
No