I have a mysql database but I can't delete it. I'm missing my migration files in an asp.net project and I made some changes in the dbcontext file.
When I try to create a new migration and update the database, it shows that table 'aspnetroles' already exists. what do I do? How to revert migration or how to make migration and database equal?
EF Core Migrations'
dotnet ef database update
will attempt to update the database to the latest migrations. It will query the__EFMigrationsHistory
table to see which migrations have been applied and which ones still need to be applied (if any).The solution to some problems is to simulate the updates being applied by manually inserting the migration history. This avoids deleting the database, which can be problematic in a production environment.
Insert records into the development database as follows: