Closed lleger closed 7 years ago
That's how to do it currently. There're no helpers in EctoEnum for handling at the moment.
For reference in case someone comes here looking for an answer, here's how we did it with an Ecto migration:
defmodule MyApp.Repo.Migrations.ChangeFooEnumToBarEnum do
use Ecto.Migration
def up do
execute("ALTER TYPE foo_enum RENAME TO bar_enum")
end
def down do
execute("ALTER TYPE bar_enum RENAME TO foo_enum")
end
end
In our app, we renamed a model and so the enum needed to be changed as well:
ModelName
->NewModelName
ModelTypeEnum
->NewModelTypeEnum
Is there a good way to rename enums? Currently, we're creating a new enum definition entirely and migrating the PG columns manually.