Entity Framework - Recreate my database and re-start my DB migrations
If you would like to recreate your database and start again with your migrations from scratch just follow up this simple steps:
1. Go to your MS SQL Server and delete the database
2. Go to your Visual Studio (I'm currently using VS2015) and locate your "migrations" folder and delete any migration you have (do not delete the "Configuration.cs" file if you have it.
3. Add a configuration file into your migrations folder if you don't have it by enabling migrations from the package manager console.
Enable-migrations
Enable-migrations
4. Add or Update the AutomaticMigrationsEnabled to true
5. Run your project
Now you will see that your database was created again, if so, continue the step #6.
If you don't see the database go to step #7
6. Recreate the Initial migration by running this command from the package manager console:
Enable-migrations -Force
* If you enable migrations through step 6 then, It should not be necessary to continue with step 7
7. Run the next commands from your package manager console:
Add-Migration InitialCreate
Update-Database -verbose
If you don't see the database go to step #7
6. Recreate the Initial migration by running this command from the package manager console:
Enable-migrations -Force
* If you enable migrations through step 6 then, It should not be necessary to continue with step 7
7. Run the next commands from your package manager console:
Add-Migration InitialCreate
Update-Database -verbose