Files
NexaPG/backend/alembic/versions/0007_email_templates.py
nessi c437e72c2b
All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 7s
Add customizable email templates and remove alert recipients
Replaced the fixed `alert_recipients` list with customizable subject and body templates for alerts and warnings. This allows for more flexible and dynamic email notifications using placeholder variables. Updated relevant backend and frontend components to support this feature.
2026-02-12 16:32:53 +01:00

32 lines
1.3 KiB
Python

"""email templates and drop recipients list
Revision ID: 0007_email_templates
Revises: 0006_email_from_name
Create Date: 2026-02-12
"""
from alembic import op
import sqlalchemy as sa
revision = "0007_email_templates"
down_revision = "0006_email_from_name"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("email_notification_settings", sa.Column("warning_subject_template", sa.Text(), nullable=True))
op.add_column("email_notification_settings", sa.Column("alert_subject_template", sa.Text(), nullable=True))
op.add_column("email_notification_settings", sa.Column("warning_body_template", sa.Text(), nullable=True))
op.add_column("email_notification_settings", sa.Column("alert_body_template", sa.Text(), nullable=True))
op.drop_column("email_notification_settings", "alert_recipients")
def downgrade() -> None:
op.add_column("email_notification_settings", sa.Column("alert_recipients", sa.JSON(), nullable=False, server_default="[]"))
op.drop_column("email_notification_settings", "alert_body_template")
op.drop_column("email_notification_settings", "warning_body_template")
op.drop_column("email_notification_settings", "alert_subject_template")
op.drop_column("email_notification_settings", "warning_subject_template")