Oleg Sh
Oleg Sh

Reputation: 9013

EF Code First Migration list

I want to see all available of migrations in a project. Command Get-Migrations returns all applied migrations to DB, but I want to see all migration list, including not applied. Reason : I have created one more migration in the project and want to remove it. I removed files of migration, but Visual Studio (solution) remember of this migration and want to apply it.

enter image description here

Where is 201706071156593_AutomaticMigration at all and how to remove it?

Upvotes: 1

Views: 3514

Answers (1)

Richard
Richard

Reputation: 30628

Deleting the files should be sufficient - have you built the project since?

You can programmatically access the list of migrations using the DbMigrator class, which has a method GetPendingMigrations() which will return the name of all migrations which it is aware of that have not yet been applied.

Update: Now that you've updated your question with the migration name, it becomes clear that because you have Automatic Migrations enabled (in the constructor of Configuration), this is the cause. To use explicit migrations only, change AutomaticMigrationsEnabled to false.

Upvotes: 1

Related Questions