Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity framework code first - how to run Update-Database for production database

I wanting to know how to run the 'Update-Database' command for a production database.

The 'Update-Database' database works fine from my local machine, but how do I get this to work for production data?

So, if I make a change to my application and then run the 'publish' through visual studio this works fine for the code side of things, but how do I run the 'Update-Database' command for the production data.

Hope this question makes sense...

Thanks,

like image 580
haydnD Avatar asked Mar 30 '13 05:03

haydnD


1 Answers

See Using Entity Framework (code first) migrations in production so that your application automatically updates the database when the Entity Framework initializes.

Now if you're more comfortable having manual control over the migration, you could use the -Script argument to the Update-Database command on your developer machine to generate SQL scripts which you can then run against the production database.

http://msdn.microsoft.com/en-us/data/jj591621.aspx (see Getting A SQL Script section)

like image 79
David Moore Avatar answered Oct 19 '22 22:10

David Moore