Fix notifications fleet alert migration for MySQL and add UI fields

- Change alertscope from JSONB to TEXT for MySQL compatibility
- Add Alert Fleet checkbox, scope, and timeout fields to notification form
- Fields appear conditionally when Alert Fleet is checked
This commit is contained in:
Proudlock
2026-09-08 16:57:00 -04:00
parent 381cc6c845
commit 6340648ad9
2 changed files with 56 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ to support fleet-wide alert broadcasting. Creates notificationacknowledgements
table to track which assets have acknowledged fleet alerts.
Fleet alerts can be scoped to specific asset types, locations, or business units
via the alertscope JSONB field. alerttimeout=0 means no auto-dismiss (manual only).
via the alertscope TEXT field (JSON string). alerttimeout=0 means no auto-dismiss (manual only).
Idempotent: column and table creation are skipped when they already exist.
@@ -14,7 +14,6 @@ Revises: notifications0005boardorder
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSONB
revision = 'notifications0006fleetalerts'
@@ -43,7 +42,7 @@ def upgrade():
if 'alertscope' not in cols:
op.add_column('notifications',
sa.Column('alertscope', JSONB, nullable=True))
sa.Column('alertscope', sa.Text, nullable=True))
if 'alerttimeout' not in cols:
op.add_column('notifications',