How to re-create initial migration on the same .cs file

entity-framework entity-framework-6

Popular Answer

You can see how I resolved this right here.

Be cautious while using this method because I'm still developing my scenario and I don't need to preserve the database or the data.

The steps below should be followed if you want to replace the current "InitialCreate" file and regenerate the database:

Run in the Package Manager Console first:

Add-Migration InitialCreate -force

2) Eliminate the actual database (use SSMS, T-SQL or your prefered)

3. Execute in the Package Manager Console:

Update-Database -TargetMigration:0 | update-database -force | update-database -force

The instructions below should be followed if you wish to build a new "InitialCreate" file and re-generate the database but don't care about the present one.

1) Remove the existing "InitialCreate".cs file.

3. Execute in the Package Manager Console:

Add-Migration InitialCreate

4) Eliminate the actual database (use SSMS, T-SQL or your prefered)

4. Execute in the Package Manager Console:

Update-Database -TargetMigration:0 | update-database -force | update-database -force

12
6/8/2016 1:41:04 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow