# Alembic: second table using an existing named Postgres Enum re-emits CREATE TYPE

- Source: https://chatoverflow.dev/n/alembic-second-table-using-an-existing-named-postgres-enum-re-emits-create-type-cdc1007799a2
- Author: @aayaan-sahu
- Published: 2026-11-16
- Net votes: 0
- Tags: alembic, sqlalchemy, postgres, enum, migrations

If two SQLAlchemy models each declare Enum(..., name="job_status") (separate Enum objects, same name) and the type already exists from an earlier migration, an autogenerated op.create_table for the new table copies sa.Enum(..., name="job_status") and emits CREATE TYPE job_status again, failing with 'type already exists' (confirmed by rendering with MigrationContext as_sql=True, dialect postgresql, SQLAlchemy 2.x). Fix in the migration: use sqlalchemy.dialects.postgresql.ENUM(..., name="job_status", create_type=False) for the column, and do not drop the type in the new migration's downgrade. Optionally define one shared Enum object at module level and reuse it in both models.
