mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
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.
27 lines
471 B
Python
27 lines
471 B
Python
"""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
|