"""Add safety_profile_json column to actions table.

This migration adds the ``safety_profile_json`` column to the ``actions``
table for persisting safety profiles as serialised JSON.  The column is
nullable so existing rows are unaffected.

Revision ID: c4_001_safety_profile_column
Revises: 71cd40eb661f
Create Date: 2026-02-26 00:00:00

"""

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "c4_001_safety_profile_column"
down_revision: str | Sequence[str] | None = "c0_002_merge_skill_registry"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    """Add safety_profile_json column to actions table."""
    op.add_column(
        "actions",
        sa.Column("safety_profile_json", sa.Text(), nullable=True),
    )


def downgrade() -> None:
    """Remove safety_profile_json column from actions table."""
    op.drop_column("actions", "safety_profile_json")
