Files
CheckInApp/apps/backend/migration_steps/email_notification_settings.py
8a12744 ce55cfc6b3 feat(email): require verified approval email
Backfill approved legacy users with verified emails and replace the old unverified-email warning setting with a single approval email policy.
2026-05-06 22:12:23 +08:00

29 lines
1.1 KiB
Python

from __future__ import annotations
from sqlalchemy import text
from sqlalchemy.engine import Connection
def apply(conn: Connection) -> None:
conn.execute(
text(
"""
CREATE TABLE IF NOT EXISTS email_notification_settings (
id INTEGER PRIMARY KEY,
smtp_server VARCHAR(255) NOT NULL DEFAULT '',
smtp_port INTEGER NOT NULL DEFAULT 465,
smtp_sender_email VARCHAR(255) NOT NULL DEFAULT '',
smtp_sender_password VARCHAR(500) NOT NULL DEFAULT '',
smtp_use_ssl BOOLEAN NOT NULL DEFAULT 1,
notify_token_expiring BOOLEAN NOT NULL DEFAULT 1,
notify_check_in_success BOOLEAN NOT NULL DEFAULT 1,
require_admin_approval_for_registration BOOLEAN NOT NULL DEFAULT 1,
require_verified_email_for_approval BOOLEAN NOT NULL DEFAULT 1,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME
)
"""
)
)
conn.commit()