Files
JQC_multi_tenant/migrations/versions/phase24_issue_created_notify_defaults.py
T
2026-06-26 09:04:34 -04:00

33 lines
966 B
Python

"""phase24 — enable issue_created notifications for admin and director by default
Sets enabled=True for ('issue_created', 'admin') and ('issue_created', 'director')
in the notification_matrix table if those rows already exist (created when an admin
previously saved the matrix page). Rows that do not exist are left alone — the
updated MATRIX_DEFAULTS in notification_matrix.py covers those at runtime.
"""
from alembic import op
revision = 'phase24_notify_defaults'
down_revision = 'phase23_support_tickets'
branch_labels = None
depends_on = None
def upgrade():
op.execute("""
UPDATE notification_matrix
SET enabled = 1
WHERE event_type = 'issue_created'
AND role_key IN ('admin', 'director')
""")
def downgrade():
op.execute("""
UPDATE notification_matrix
SET enabled = 0
WHERE event_type = 'issue_created'
AND role_key IN ('admin', 'director')
""")