I am developing an application in ASP.NET MVC 5 and Entity Framework with a code-first approach.
Firstly, I had one class in my data context file and everything worked. enable-migrations, add-migration and update-database were working fine but second time, I added more classes and tried to execute these statements:
enable-migrations -ContextTypeName IdentityDb -MigrationsDirectory DAL\IdentityMigrations
enable-migrations -ContextTypeName SMSContext -MigrationsDirectory DAL\SMSMigrations
add-migration -ConfigurationTypeName SMSApp.DAL.IdentityMigrations.Configuration "InitialCreate"
I get an exception:
A previous migration called 'InitialCreate' was already applied to the target database. If you meant to re-scaffold 'InitialCreate', revert it by running 'Update-Database -TargetMigration $InitialDatabase', then delete '201409261933262_InitialCreate1.cs' and run 'Add-Migration InitialCreate' again.