entity framework - CodeFirst DB Migrations with Azure -
i've far been unsuccessful @ getting automatic migrations work visual studio online code repo that's configured automatically deploy azure.
there's similar question here that's unanswered: entityframework automatic migrations azure git deployment
my issue right now, databases out of sync between local working copy , azure db, when code deploys successfully, application no longer functions, since database not updated match new classes.
i've tried several approaches:
webapi.config updated include migrator.
var migrator = new dbmigrator(new configuration()); migrator.update();
web.config updated include migrate latest version
<add key="migratedatabasetolatestversion" value="true"/>
migrations configuration updated enable automatic
automaticmigrationsenabled = true;
publishing directly visual studio via publish manager - still doesn't execute db updates on azure site. (including checking option box execute migrations)
anyone been able work?
edit: i've tried this, unsuccessfully, post deploy work-around, no luck either. http://robertgreiner.com/2012/05/using-entity-framework-database-migrations-to-update-a-remote-database/
i've discovered believe root cause (code wise, actual root cause i'm idiot). have configured in web.config localdb client, migrations happening against db. commenting out db , allowing update-database command in package manager run against azuredb updated database on azure correctly.
i'm still not totally sure why migrations aren't working, i'm suspecting it's due web.config file i'm deploying default db set azure doesn't know (localdb).
so work-around @ least, while fix web.config settings deploy correct db azure.
Comments
Post a Comment