Files
FabledSteward/steward/migrations/versions/0012_ansible_run_nullable.py
T
bvandeusen 5af7312a72
CI / lint (push) Successful in 3s
CI / unit (push) Successful in 7s
CI / integration (push) Successful in 2m21s
fix(ansible): shorten migration 0012 revision id to fit alembic_version(32)
The id 0012_ansible_run_triggered_by_nullable was 38 chars; alembic_version.
version_num is VARCHAR(32), so stamping it raised StringDataRightTruncationError
and the boot/migrate integration lane failed. Renamed to 0012_ansible_run_nullable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:35:55 -04:00

34 lines
913 B
Python

"""Make ansible_runs.triggered_by nullable (automated runs have no user)
Revision ID: 0012_ansible_run_nullable
Revises: 0011_audit_log
Create Date: 2026-06-02
Note: the revision id is kept <=32 chars to fit alembic_version.version_num.
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "0012_ansible_run_nullable"
down_revision: Union[str, None] = "0011_audit_log"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.alter_column(
"ansible_runs", "triggered_by",
existing_type=sa.String(36),
nullable=True,
)
def downgrade() -> None:
# Re-imposes NOT NULL; will fail if any system-triggered (NULL) rows exist.
op.alter_column(
"ansible_runs", "triggered_by",
existing_type=sa.String(36),
nullable=False,
)