SQLAlchemy doesn't generate a CREATE/DROP script for an existing enumeration datatype in Postgresql.
For that, you need to manually change your generated version script - versions/HASH_NUMBER.py
and change the
datatype manually.
versions/SHA.py
def upgrade():
if not op.get_context().as_sql:
connection = op.get_bind()
connection.execution_options(isolation_level='AUTOCOMMIT')
op.execute("ALTER TYPE currency ADD VALUE IF NOT EXISTS 'BRL'")
or you can do it directly on the psql
client.
issue related: sqlalchemy/alembic#123