Ilya Leykin Ilya Leykin - 4 months ago 55
C# Question

How to update database on remote ms sql server (EF Code First)

While developing an application I used EF automatic migrations. So now when I have deployed my app on VPS, I don't know how to add new tables and fields to my database.

Can I connect to the remote database directly from my project in VS2012, updating a connection string, and update the database using "update-database" in package manager console? Or do I need to install VS on my VPS and update the database from VPS?

My database is already filled with data, so I can't delete it and create again.


yes you can using Visual Studio, follow this tutorial it should work for VS 2012 too.
you can also use Code first Migration to update your model by using this command in package manager console :


and you can specify your connection string name in above command :

Update-Database -ConnectionStringName "MyConnectionString"