Files
NexaPG/backend/alembic/versions/0004_email_settings.py
nessi 51eece14c2
All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 6s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 6s
Add email notification settings management
Implemented backend and frontend support for managing SMTP settings for email notifications. Includes API endpoints, database migration, and UI integration for configuring and testing email alerts.
2026-02-12 15:05:21 +01:00

39 lines
1.5 KiB
Python

"""add email notification settings
Revision ID: 0004_email_settings
Revises: 0003_pg_stat_statements_flag
Create Date: 2026-02-12
"""
from alembic import op
import sqlalchemy as sa
revision = "0004_email_settings"
down_revision = "0003_pg_stat_statements_flag"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
"email_notification_settings",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("enabled", sa.Boolean(), nullable=False, server_default=sa.text("false")),
sa.Column("smtp_host", sa.String(length=255), nullable=True),
sa.Column("smtp_port", sa.Integer(), nullable=False, server_default=sa.text("587")),
sa.Column("smtp_username", sa.String(length=255), nullable=True),
sa.Column("encrypted_smtp_password", sa.Text(), nullable=True),
sa.Column("from_email", sa.String(length=255), nullable=True),
sa.Column("use_starttls", sa.Boolean(), nullable=False, server_default=sa.text("true")),
sa.Column("use_ssl", sa.Boolean(), nullable=False, server_default=sa.text("false")),
sa.Column("alert_recipients", sa.JSON(), nullable=False, server_default=sa.text("'[]'::json")),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
def downgrade() -> None:
op.drop_table("email_notification_settings")