Migration is reapplied while trying remove it

174 Views Asked by At

We use context.Database.Migrate(); at runtime (application Main method) to apply migrations. This does not seem to work in conjunction with

Update-Database <RevertToMigration>
Remove-Migration

when trying to revert and remove a migration. The Remove-Migration command ends up calling the same code which re-applies the migration that was just reverted. Am I calling the correct commands? Is there a way to determine in the code whether or not the Remove-Migration command is being called (and therefore skip calling Migrate())? The DbContext is configured using the OnConfiguring method.

0

There are 0 best solutions below