Pipeline/backend/migrations/versions/e1f2a3b4c5d6_add_board_erro...

58 lines
1.5 KiB
Python

"""Add error escalation rule fields to boards.
Revision ID: e1f2a3b4c5d6
Revises: d4e5f6a7b8c9
Create Date: 2026-05-22
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
revision = "e1f2a3b4c5d6"
down_revision = "d4e5f6a7b8c9"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column(
"boards",
sa.Column("error_escalation_enabled", sa.Boolean(), nullable=False, server_default="false"),
)
op.alter_column("boards", "error_escalation_enabled", server_default=None)
op.add_column(
"boards",
sa.Column("error_escalation_agent_id", sa.UUID(), nullable=True),
)
op.create_foreign_key(
"fk_boards_error_escalation_agent_id_agents",
"boards",
"agents",
["error_escalation_agent_id"],
["id"],
)
op.create_index(
"ix_boards_error_escalation_agent_id",
"boards",
["error_escalation_agent_id"],
)
op.add_column(
"boards",
sa.Column("error_auto_open_issue", sa.Boolean(), nullable=False, server_default="false"),
)
op.alter_column("boards", "error_auto_open_issue", server_default=None)
def downgrade() -> None:
op.drop_column("boards", "error_auto_open_issue")
op.drop_index("ix_boards_error_escalation_agent_id", table_name="boards")
op.drop_constraint(
"fk_boards_error_escalation_agent_id_agents", "boards", type_="foreignkey"
)
op.drop_column("boards", "error_escalation_agent_id")
op.drop_column("boards", "error_escalation_enabled")