Skip to content

Commit

Permalink
Add migration: unique constraint for group-role-association
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Aug 29, 2024
1 parent 3895a81 commit 32e8798
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Add unique constraint to group-role-association
Revision ID: 7cdc4eaff558
Revises: ad1d893fa15f
Create Date: 2024-08-29 15:18:05.790399
"""

from galaxy.model.migrations.util import (
create_unique_constraint,
drop_constraint,
transaction,
)

# revision identifiers, used by Alembic.
revision = "7cdc4eaff558"
down_revision = "ad1d893fa15f"
branch_labels = None
depends_on = None

table_name = "group_role_association"
constraint_column_names = ["group_id", "role_id"]
unique_constraint_name = (
"group_role_association_group_id_key" # This is what the model's naming convention will generate.
)


def upgrade():
with transaction():
create_unique_constraint(unique_constraint_name, table_name, constraint_column_names)


def downgrade():
with transaction():
drop_constraint(unique_constraint_name, table_name)

0 comments on commit 32e8798

Please sign in to comment.