I created a table Documents
using Entity Framework Core and the Add-Migration
command. I also did some modifications related to foreign key in Table 1 using EF Core migrations and updated the database.
But after some time, I dropped the table Documents
using a SQL drop table
command instead of deleting it.
Now, how can I sync up my database with my migration state in code? Is there a command to run set of migration from migration mig1 to mig2 and update database?
The problem you have is that your snapshot is out of sync with your actual database.
To fix it:
In your migration snapshot comment out the code that relates to the specific table you deleted.
Do a new migration (add-migration) to 'introduce' your previously deleted table to EF
update-database to apply your migration