Scope monitoring TG by department
This commit is contained in:
52
alembic/versions/0010_department_sections.py
Normal file
52
alembic/versions/0010_department_sections.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""department-scoped sections
|
||||
|
||||
Revision ID: 0010
|
||||
Revises: 0009
|
||||
Create Date: 2026-06-04
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0010"
|
||||
down_revision: Union[str, None] = "0009"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.alter_column(
|
||||
"app_settings",
|
||||
"key",
|
||||
existing_type=sa.String(length=128),
|
||||
type_=sa.String(length=255),
|
||||
existing_nullable=False,
|
||||
)
|
||||
op.add_column("sections", sa.Column("department_id", sa.String(length=64), nullable=True))
|
||||
op.drop_column("sections", "access_code")
|
||||
op.drop_constraint("uq_section_vertical_slug", "sections", type_="unique")
|
||||
op.create_unique_constraint(
|
||||
"uq_section_vertical_department_slug",
|
||||
"sections",
|
||||
["vertical", "department_id", "slug"],
|
||||
)
|
||||
op.drop_index("ix_sections_vertical", table_name="sections")
|
||||
op.create_index("ix_sections_vertical_department", "sections", ["vertical", "department_id"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index("ix_sections_vertical_department", table_name="sections")
|
||||
op.create_index("ix_sections_vertical", "sections", ["vertical"])
|
||||
op.drop_constraint("uq_section_vertical_department_slug", "sections", type_="unique")
|
||||
op.create_unique_constraint("uq_section_vertical_slug", "sections", ["vertical", "slug"])
|
||||
op.add_column("sections", sa.Column("access_code", sa.String(length=255), nullable=True))
|
||||
op.drop_column("sections", "department_id")
|
||||
op.alter_column(
|
||||
"app_settings",
|
||||
"key",
|
||||
existing_type=sa.String(length=255),
|
||||
type_=sa.String(length=128),
|
||||
existing_nullable=False,
|
||||
)
|
||||
Reference in New Issue
Block a user