You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Migrations does not properly work with calculated properties #12726
I have a computed column for remaining amount. It's calculated as total amount minus amount. So, it has public getter and unavailable setter declared as
So, when I'm adding a migration, without any additional manipulation it gets me an SQL error of the dependency this computed column on altering column.
SQL profiled doesn't indicate that EF is trying to drop that column. Do I miss anything? How do I have to instruct EF to drop that column before altering main one?
changed the title [-]Migrations does not properly work with migrations[/-][+]Migrations does not properly work with calculated properties[/+]on Jul 19, 2018
I think fixing #6853 was the most we could do for computed columns without actually parsing the SQL (a complexity we desperately wish to avoid).
Manually rebuilding the computed column in the migration is the correct way to handle this. I was able to make this work locally. Hard to say what went wrong. Perhaps you forgot to save the migration after editing it?
Hi @bricelam
Thank you for your efforts! I don't think that I can recall anything from what was happening more than a year ago. However, I do remember that I used a workaround with a direct SQL script. Also, I think it's a good idea to close this ticket since I have no usage of it anymore. Please reopen it if you think that would be appropriate.
Activity
[-]Migrations does not properly work with migrations[/-][+]Migrations does not properly work with calculated properties[/+]6 remaining items
bricelam commentedon Oct 9, 2019
I think fixing #6853 was the most we could do for computed columns without actually parsing the SQL (a complexity we desperately wish to avoid).
Manually rebuilding the computed column in the migration is the correct way to handle this. I was able to make this work locally. Hard to say what went wrong. Perhaps you forgot to save the migration after editing it?
iamkarlson commentedon Oct 9, 2019
Hi @bricelam
Thank you for your efforts! I don't think that I can recall anything from what was happening more than a year ago. However, I do remember that I used a workaround with a direct SQL script. Also, I think it's a good idea to close this ticket since I have no usage of it anymore. Please reopen it if you think that would be appropriate.