05/17 fix migration script
This commit is contained in:
@@ -33,6 +33,8 @@ class RecoveryChallenge(db.Model):
|
|||||||
__tablename__ = 'recovery_challenges'
|
__tablename__ = 'recovery_challenges'
|
||||||
|
|
||||||
id = db.Column(INTEGER(unsigned=True), autoincrement=True, primary_key=True)
|
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(
|
user_id = db.Column(
|
||||||
INTEGER(unsigned=True),
|
INTEGER(unsigned=True),
|
||||||
db.ForeignKey('users.id', ondelete='CASCADE'),
|
db.ForeignKey('users.id', ondelete='CASCADE'),
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ def upgrade():
|
|||||||
op.create_table(
|
op.create_table(
|
||||||
'recovery_challenges',
|
'recovery_challenges',
|
||||||
sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
|
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('nonce', sa.String(64), nullable=False),
|
||||||
sa.Column('expected_proof', sa.String(64), nullable=False),
|
sa.Column('expected_proof', sa.String(64), nullable=False),
|
||||||
sa.Column('expires_at', sa.DateTime(), nullable=False),
|
sa.Column('expires_at', sa.DateTime(), nullable=False),
|
||||||
|
|||||||
Reference in New Issue
Block a user