How to resume database migration
P粉418214279
P粉418214279 2023-09-09 00:36:28
0
1
589

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?

P粉418214279
P粉418214279

reply all(1)
P粉337385922

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:

MigrationId ProductVersion
20230516084711_Initial 7.0.5
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template