mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
Add migration to set default alert selector (#7475)
In commitsfc1e1f7ande44fcdba new Selector option was added to alerts, which may be "first", "min" or "max". This migration sets the default to "first" for existing alerts.
This commit is contained in:
26
migrations/versions/1655999df5e3_default_alert_selector.py
Normal file
26
migrations/versions/1655999df5e3_default_alert_selector.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""set default alert selector
|
||||
|
||||
Revision ID: 1655999df5e3
|
||||
Revises: 9e8c841d1a30
|
||||
Create Date: 2025-07-09 14:44:00
|
||||
|
||||
"""
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user