-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete username unique index from User table
CLOUDBLD-7737 Cachito DB currently uses 'username' in table User as both unique constraint and unique index. Alembic will attempt to drop the unique constraint as they are redundant. To prevent this, drop ix_user_username - the unique index. Signed-off-by: Daniel Cho <dacho@redhat.com>
- Loading branch information
1 parent
2d19dce
commit 92c823c
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
cachito/web/migrations/versions/02229e089b24_delete_user_username_index.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Remove User.username unique index | ||
Revision ID: 02229e089b24 | ||
Revises: 7d979987402d | ||
Create Date: 2021-12-15 21:37:30.582812 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "02229e089b24" | ||
down_revision = "7d979987402d" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
with op.batch_alter_table("user", schema=None) as batch_op: | ||
batch_op.drop_index("ix_user_username") | ||
|
||
|
||
def downgrade(): | ||
with op.batch_alter_table("user", schema=None) as batch_op: | ||
batch_op.create_index("ix_user_username", ["username"], unique=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters