diff --git a/anitya/db/migrations/versions/ebc827e80373_remove_unique_attribute_from_username.py b/anitya/db/migrations/versions/ebc827e80373_remove_unique_attribute_from_username.py index ae78b777..6a4a3291 100644 --- a/anitya/db/migrations/versions/ebc827e80373_remove_unique_attribute_from_username.py +++ b/anitya/db/migrations/versions/ebc827e80373_remove_unique_attribute_from_username.py @@ -15,12 +15,16 @@ def upgrade(): """Alembic migration.""" # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint("ix_users_username", "users", type_="unique") + # Remove the index and recreate it as there is no way to remove just the unique + # constrain from index + op.drop_index("ix_users_username", "users") + op.create_index("ix_users_username", "users", ["username"]) # ### end Alembic commands ### def downgrade(): """Downgrade migration.""" # ### commands auto generated by Alembic - please adjust! ### - op.create_unique_constraint("ix_users_username", "users", ["username"]) + op.drop_index("ix_users_username", "users") + op.create_index(op.f("ix_users_username"), "users", ["username"], unique=True) # ### end Alembic commands ###