If i have a table with an enum column and then later i change the values in this enum, do i need to create a new migration and/or update database?
I have this enum for a property in my model:
public enum Response
{
None,
Yes,
No
}
then i migrade to the database and begin using it as such in my app.
but then later i decide i need more options in that enum so i just add another value. Do i need to update the database, or is this irrelevant since it is an integer anyway?
It should work. As you said it is just an integer column. Take care though to add new values at the end (or to give explicit values) to avoid changing mistakenly the underlying integer for a given option.
Member
168 Points
201 Posts
Changing enum values to database
May 06, 2020 09:46 AM|bluMarmalade|LINK
If i have a table with an enum column and then later i change the values in this enum, do i need to create a new migration and/or update database?
I have this enum for a property in my model:
then i migrade to the database and begin using it as such in my app.
but then later i decide i need more options in that enum so i just add another value. Do i need to update the database, or is this irrelevant since it is an integer anyway?
All-Star
48510 Points
18071 Posts
Re: Changing enum values to database
May 06, 2020 12:00 PM|PatriceSc|LINK
Hi,
It should work. As you said it is just an integer column. Take care though to add new values at the end (or to give explicit values) to avoid changing mistakenly the underlying integer for a given option.