"""Uptime / SLA folds into Monitors (#5250) Revision ID: 0033_retire_uptime_widget Revises: 0032_retire_duplicate_widgets Create Date: 2026-10-07 The Monitors widget now shows each monitor's uptime over 24h, 7d and 30d, so the separate Uptime / SLA widget (uptime_summary) repeated it. A dashboard that already shows Monitors loses the Uptime placement; any other keeps the cell, now showing Monitors. The same steps as 0032. """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa revision: str = "0033_retire_uptime_widget" down_revision: Union[str, None] = "0032_retire_duplicate_widgets" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None _OLD, _NEW = "uptime_summary", "monitors" def upgrade() -> None: op.execute(sa.text(""" DELETE FROM dashboard_widgets d WHERE d.widget_key = :old AND EXISTS (SELECT 1 FROM dashboard_widgets k WHERE k.dashboard_id = d.dashboard_id AND k.widget_key = :new) """).bindparams(old=_OLD, new=_NEW)) op.execute(sa.text(""" DELETE FROM dashboard_widgets d WHERE d.widget_key = :old AND EXISTS (SELECT 1 FROM dashboard_widgets k WHERE k.dashboard_id = d.dashboard_id AND k.widget_key = :old AND k.id < d.id) """).bindparams(old=_OLD)) op.execute(sa.text(""" UPDATE dashboard_widgets SET widget_key = :new, config_json = NULL WHERE widget_key = :old """).bindparams(old=_OLD, new=_NEW)) def downgrade() -> None: # One-way, as 0032: the retired widget no longer exists to render. pass