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
Yep, if you need to add new values and leave all old values it will work without any problems, so if you have
status ('pending', 'active')
and want to have
status ('pending', 'active', 'canceled')
just make a migration like
But if some of old values are going to be removed you should take care of objects with such values manually. For example if you need to rename some value you should do like this:
execute('update tasks set status="active" where status="actice"')
change_column :tasks, :status, :enum, :limit => [:pending, :active]
Is there a way to add enum's to existing tables?
Also If I need to add a new value to the enum what is the syntax.
I want to change an enum column from
From
status ('pending', 'active')
To
status ('pending', 'active', 'canceled')
and can I do something like this?
The text was updated successfully, but these errors were encountered: