# plugins/host_agent/migrations/versions/host_agent_005_updates.py """host_agent: a host's pending updates and whether it needs a reboot (#5765) Revision ID: host_agent_005_updates """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa revision: str = "host_agent_005_updates" down_revision: Union[str, None] = "host_agent_004_downtime" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None _COLUMNS = ( ("updates_manager", sa.String(8)), ("updates_pending", sa.Integer()), ("updates_security", sa.Integer()), ("updates_checked_at", sa.DateTime(timezone=True)), ("updates_error", sa.String(200)), ("reboot_required", sa.Boolean()), ("reboot_required_since", sa.DateTime(timezone=True)), ("reboot_packages", sa.Text()), ) def upgrade() -> None: for name, kind in _COLUMNS: op.add_column("host_agent_registrations", sa.Column(name, kind, nullable=True)) def downgrade() -> None: for name, _kind in reversed(_COLUMNS): op.drop_column("host_agent_registrations", name)