diff --git a/migrations/versions/1655999df5e3_default_alert_selector.py b/migrations/versions/1655999df5e3_default_alert_selector.py new file mode 100644 index 0000000000..6b82042f84 --- /dev/null +++ b/migrations/versions/1655999df5e3_default_alert_selector.py @@ -0,0 +1,26 @@ +"""set default alert selector + +Revision ID: 1655999df5e3 +Revises: 9e8c841d1a30 +Create Date: 2024-10-18 11:24:49 + +""" + +from alembic import op + +# revision identifiers, used by Alembic. +revision = '1655999df5e3' +down_revision = '9e8c841d1a30' +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute(""" + UPDATE alerts + SET options = jsonb_set(options, '{selector}', '"first"') + WHERE options->>'selector' IS NULL; + """) + +def downgrade(): + pass