Files
monitoring-tg/alembic/versions/0007_add_channel_vertical.py
2026-06-04 14:55:41 +03:00

38 lines
928 B
Python

"""split channels into two verticals: real_estate / hr
Existing rows get `real_estate` per the migration decision — the service was
real-estate-only before this column existed.
Revision ID: 0007
Revises: 0006
Create Date: 2026-05-19
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "0007"
down_revision: Union[str, None] = "0006"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
"channels",
sa.Column(
"vertical",
sa.String(length=32),
nullable=False,
server_default="real_estate",
),
)
op.create_index("ix_channels_vertical", "channels", ["vertical"])
def downgrade() -> None:
op.drop_index("ix_channels_vertical", table_name="channels")
op.drop_column("channels", "vertical")