34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""add account recovery columns to users
|
|
|
|
Revision ID: b2c3d4e5f6a7
|
|
Revises: a1b2c3d4e5f6
|
|
Create Date: 2026-04-18 00:00:01.000000
|
|
|
|
Adds two nullable columns to users:
|
|
- recovery_enc_salt VARCHAR(128): enc_key_salt re-encrypted with the recovery key
|
|
- recovery_iv VARCHAR(64): 12-byte GCM nonce for the above (base64)
|
|
|
|
These are populated client-side when the user sets up account recovery.
|
|
NULL means no recovery code has been generated yet.
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = 'b2c3d4e5f6a7'
|
|
down_revision = 'a1b2c3d4e5f6'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
with op.batch_alter_table('users', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('recovery_enc_salt', sa.String(length=128), nullable=True))
|
|
batch_op.add_column(sa.Column('recovery_iv', sa.String(length=64), nullable=True))
|
|
|
|
|
|
def downgrade():
|
|
with op.batch_alter_table('users', schema=None) as batch_op:
|
|
batch_op.drop_column('recovery_iv')
|
|
batch_op.drop_column('recovery_enc_salt')
|