35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
|
|
"""group name unique per org
|
||
|
|
|
||
|
|
Revision ID: 98e20aae555c
|
||
|
|
Revises: b6c8614ef799
|
||
|
|
Create Date: 2026-06-15 11:05:16.673658
|
||
|
|
|
||
|
|
"""
|
||
|
|
from typing import Sequence, Union
|
||
|
|
|
||
|
|
from alembic import op
|
||
|
|
import sqlalchemy as sa
|
||
|
|
|
||
|
|
|
||
|
|
# revision identifiers, used by Alembic.
|
||
|
|
revision: str = '98e20aae555c'
|
||
|
|
down_revision: Union[str, Sequence[str], None] = 'b6c8614ef799'
|
||
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
||
|
|
depends_on: Union[str, Sequence[str], None] = None
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade() -> None:
|
||
|
|
"""Upgrade schema."""
|
||
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
|
op.drop_constraint(op.f('group_name_key'), 'group', type_='unique')
|
||
|
|
op.create_unique_constraint('uniq_group_name_org_id', 'group', ['name', 'org_id'])
|
||
|
|
# ### end Alembic commands ###
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade() -> None:
|
||
|
|
"""Downgrade schema."""
|
||
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
|
op.drop_constraint('uniq_group_name_org_id', 'group', type_='unique')
|
||
|
|
op.create_unique_constraint(op.f('group_name_key'), 'group', ['name'], postgresql_nulls_not_distinct=False)
|
||
|
|
# ### end Alembic commands ###
|