5af7312a72
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>
34 lines
913 B
Python
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,
|
|
)
|