05/17 fix migration script 2

This commit is contained in:
Nguyen Ngo
2026-05-17 18:34:29 -04:00
parent e563693f40
commit 22fff0660e
@@ -18,6 +18,7 @@ delete expired rows without a full scan.
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.mysql import INTEGER as mysql_INTEGER
revision = 'e5f6a7b8c9d0'
@@ -29,10 +30,10 @@ depends_on = None
def upgrade():
op.create_table(
'recovery_challenges',
sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
sa.Column('id', mysql_INTEGER(unsigned=True), nullable=False, autoincrement=True),
# user_id must be INTEGER UNSIGNED to match users.id (UNSIGNED primary key).
# MySQL 8 enforces strict type compatibility for foreign keys.
sa.Column('user_id', sa.Integer(unsigned=True), nullable=False),
sa.Column('user_id', mysql_INTEGER(unsigned=True), nullable=False),
sa.Column('nonce', sa.String(64), nullable=False),
sa.Column('expected_proof', sa.String(64), nullable=False),
sa.Column('expires_at', sa.DateTime(), nullable=False),