05/17 fix migration script

This commit is contained in:
Nguyen Ngo
2026-05-17 18:33:01 -04:00
parent afc3250c48
commit e563693f40
2 changed files with 5 additions and 1 deletions
+2
View File
@@ -33,6 +33,8 @@ class RecoveryChallenge(db.Model):
__tablename__ = 'recovery_challenges'
id = db.Column(INTEGER(unsigned=True), autoincrement=True, primary_key=True)
# user_id must be UNSIGNED to match users.id (UNSIGNED primary key).
# MySQL 8 enforces strict type compatibility on foreign key column pairs.
user_id = db.Column(
INTEGER(unsigned=True),
db.ForeignKey('users.id', ondelete='CASCADE'),
@@ -30,7 +30,9 @@ def upgrade():
op.create_table(
'recovery_challenges',
sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
sa.Column('user_id', sa.Integer(), nullable=False),
# 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('nonce', sa.String(64), nullable=False),
sa.Column('expected_proof', sa.String(64), nullable=False),
sa.Column('expires_at', sa.DateTime(), nullable=False),