How to re-create the database using EF6?
I have tried both of following post but, i don\'t know why its not working and getting same error.
Chris Pratt is correct BTW.
I had downloaded a project in which I needed to just run "Update-Database
Here are the quick screenshots
Then at the bottom of Visual Studio
PM> Update-Database
DONE
First, automatic migrations are nice for development but it's a hugely bad idea to rely on them in production. Second, at some point you turned off automatic migrations, which is why your production database is no longer having tables created in it.
Go ahead and leave automatic migrations off; even in development it's better to know exactly what changes you're making to your database by generating a migration, seeing the code that will be executed, and only then running Update-Database
to apply those changes.
You have a number of choices in terms of getting schema updates into production, but they all boil down to roughly the same procedure.
Update-Database -Script
. This will generate a SQL file with the code to run on the database to migrate the schema. Hand this off to your DBA if you have one or review the SQL code yourself and then apply it manually to your database via Management Studio.Update-Database
. This time without -Script
to make the changes to your local database schema.