Skip to content

Fix Alembic 0003 duplicate role_enum constraint failure#37

Merged
chrystianmartins merged 1 commit into
mainfrom
codex/fix-duplicate-constraint-error-in-database-migration
Feb 9, 2026
Merged

Fix Alembic 0003 duplicate role_enum constraint failure#37
chrystianmartins merged 1 commit into
mainfrom
codex/fix-duplicate-constraint-error-in-database-migration

Conversation

@chrystianmartins

Copy link
Copy Markdown
Owner

Motivation

  • The migration 0003_update_user_role_enum_for_new_auth_flow was failing during alembic upgrade with psycopg.errors.DuplicateObject because the role_enum check constraint was being created twice (manually via raw SQL and implicitly via the enum type alteration).

Description

  • Removed the manual ALTER TABLE ... ADD CONSTRAINT role_enum statements from pool-coordinator/alembic/versions/0003_update_user_role_enum_for_new_auth_flow.py and retained the DROP CONSTRAINT IF EXISTS cleanup, relying on op.batch_alter_table(...).alter_column(..., type_=sa.Enum(..., create_constraint=True)) to recreate the constraint exactly once.

Testing

  • Ran make test which passed: pool-coordinator tests 39 passed, 3 skipped; pool-gateway tests 8 passed; and worker unit/cli tests passed.

Codex Task

@chrystianmartins
chrystianmartins merged commit f4d5766 into main Feb 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant