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
When create_type/0 was made to be reversible, it removed the ability to do a migration where you drop the type on the way up and recreate it on the way down.
This is because when rolling back, create_type/0 tries to run the DROP SQL when in reality we want the CREATE SQL.
One fix, perhaps is to just make drop_type/0 reversible as well. Then you'd call drop_type/0 in both up/down and it should work.
Another fix would be to change the API so that create_type/0 and drop_type/0 do what they say on the tin, and introduce a different function, e.g. migrate/0, that does a reversible action.
TL;DR it's impossible to recreate the enum type in a drop migration.
The text was updated successfully, but these errors were encountered:
When
create_type/0
was made to be reversible, it removed the ability to do a migration where you drop the type on the way up and recreate it on the way down.Example:
This throws an error:
This is because when rolling back,
create_type/0
tries to run the DROP SQL when in reality we want the CREATE SQL.One fix, perhaps is to just make
drop_type/0
reversible as well. Then you'd calldrop_type/0
in bothup
/down
and it should work.Another fix would be to change the API so that
create_type/0
anddrop_type/0
do what they say on the tin, and introduce a different function, e.g.migrate/0
, that does a reversible action.TL;DR it's impossible to recreate the enum type in a drop migration.
The text was updated successfully, but these errors were encountered: