I want to expand my enum type by adding a new enum value. This is pretty straightforward to do. I also keep all my SQL in migrations, and pair each up migration with a symmetric down migration that reverts the schema to the previous state.
However, reverse operation — removing a variant from enum — is not supported.
What's the common method around this? I can see two options:
- Write "up" migration with
if not exists
clause and do nothing in the "down" migration. I don't like this option because it violates the assumption that applying and reverting a migration leaves the schema in the same state as it was before. - Convert to a new enum type in "down" migration, as described in the question linked above — seems like an overkill for such a simple operation.