Wednesday 15 February 2012

c# - There are no pending changes for EF migration and still it complains that there are pending changes. How does EF keep track of this? -



c# - There are no pending changes for EF migration and still it complains that there are pending changes. How does EF keep track of this? -

i have several migration files in project , since made manual modifications lastly migration don't want re-generate "package manager console". need add together 1 column. added manually previous migration (i can since no-one has upgraded yet).

now, when start project, local database seems create new column fine exception: "unable update database match current model because there pending changes , automatic migration disabled"

it looks way can solve generate migration - though, migation generates same line of code wrote manually in previous migration...

i wondering - how ef maintain track of , there way bypass ?

also question - wrong of me want limit amount of migration files have ? sense in ideal situation each release of software should have 1 migration file @ in order maintain improve overview of code...

thank you,

ef saves hash of serialized model in _migrationhistory table, , compares them when utilize migrations ensure database schema matches model. not advise trying bypass this. if wish mimimise number of files can rollback combine migrations. don't think it's worth it. set migrations sub-folders periodically

i recommend article:

http://elegantcode.com/2012/04/12/entity-framework-migrations-tips/

c# entity-framework migration database-migration

No comments:

Post a Comment