Files
siftlode/backend/alembic/versions/0024_google_email_verified.py
T
peter b1832afd18 style: apply ruff format across backend + scripts (line-length 100)
Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in
.git-blame-ignore-revs (next commit) so git blame skips it.
2026-08-23 07:43:06 +02:00

33 lines
1.0 KiB
Python

"""backfill email_verified for Google accounts
Revision ID: 0024_google_email_verified
Revises: 0023_user_suspension
Create Date: 2026-06-19
A Google sign-in proves the email, but earlier Google signups were created with
email_verified=false (the callback didn't set it). Backfill those so the flag reflects reality —
matters because password-login gates on email_verified, so a Google user who later adds a password
must count as verified. Demo/password-only rows (google_sub IS NULL) are left untouched.
"""
from typing import Sequence, Union
from alembic import op
revision: str = "0024_google_email_verified"
down_revision: Union[str, None] = "0023_user_suspension"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.execute(
"UPDATE users SET email_verified = true "
"WHERE google_sub IS NOT NULL AND email_verified = false"
)
def downgrade() -> None:
# Not reversible — we can't tell which rows were flipped. No-op.
pass