mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 14:06:28 +00:00
ce55cfc6b3
Backfill approved legacy users with verified emails and replace the old unverified-email warning setting with a single approval email policy.
25 lines
597 B
Python
25 lines
597 B
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime, timezone
|
|
|
|
from sqlalchemy import text
|
|
from sqlalchemy.engine import Connection
|
|
|
|
|
|
def apply(conn: Connection) -> None:
|
|
verified_at = datetime.now(timezone.utc).isoformat()
|
|
conn.execute(
|
|
text(
|
|
"""
|
|
UPDATE users
|
|
SET email_verified_at = :verified_at
|
|
WHERE email_verified_at IS NULL
|
|
AND email IS NOT NULL
|
|
AND email != ''
|
|
AND is_approved = 1
|
|
"""
|
|
),
|
|
{"verified_at": verified_at},
|
|
)
|
|
conn.commit()
|