c# - EF Code First 6.1 Change ID from Int to Long -
i'm working on application using asp.net mvc 4, c# , entity framework code first. there 1 model (table) growing rather large , i'm worried identity column run out of values (int32.maxvalue) in next year or so.
i'm looking way change identity int long. in past when tried this, ef wouldn't let me unless if dropped table , recreated it. not option since site live , there live data in table.
is there way this? far web searches , stackoverflow searches have not given me hints on how this.
requires code-first migrations:
1) update model
2) create migration
3) write custom sql in generated migration drop pk , every fk references it. can quite messy have figure out names. put above altercolumn.
4) write custom sql re-add pk , fks , put under altercolumn.
5) reverse in down script.
fyi, isn't possible azure sql. in case must create new table.
Comments
Post a Comment