Entity Framework migrations are a great thing. They’ve made my development life a LOT easier. Automated migrations can cause problems, especially on a project with multiple developers involved. For that, we use manual migrations through the Package Manager Console.
But how do you manually run these migrations against your test (or live) server when your deployment tool doesn’t run them? If you have access to the database in question, you can add the ConnectionString and ProviderName parameters at the Package Manager Console prompt and make life a lot easier:
Update-Database -ConnectionString "MY_CONNECTION_STRING" -ConnectionProviderName "System.Data.SqlClient"
You can pull your connection string direct from your web.config transform, no special “magic” needed.
Enjoy! Continue reading “Quick Tip: Manually Run EF Migrations on External Databases”