sql - Entity framework and migrations - how to update my database on remote server? -
i enabled migrations entity framework application. now, want update database on remote server. ran command:
pm> update-database -script
so generated sql script. but, script has metadata have in database, , not changes made; so, when seek run sql script on remote server, says tables exists.
how can generate sql script, contain necessary updates?
you can target specific migration this. if have migration called foo, example:
update-database -targetmigration foo -script
it generate migration script foo migration. replace foo whatever migration need run on server.
add-migration initialmigration add-migration addcustomers add-migration addprojects
let's have above 3 migrations in project, , local database has of them applied, remote database has initialmigration. can run following:
update-database -sourcemigration initialmigration -targetmigration addprojects -script
this apply 2 migrations on remote server (addcustomers , addprojects).
sql asp.net-mvc entity-framework entity-framework-4 migration
No comments:
Post a Comment