mirror of
https://github.com/lightningcell/flask-2fa-auth.git
synced 2026-05-30 00:49:39 +00:00
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
"""Initial migration with User model
|
|
|
|
Revision ID: 4ee6bbb732e4
|
|
Revises:
|
|
Create Date: 2025-05-29 23:49:19.086429
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '4ee6bbb732e4'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('user',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('username', sa.String(length=80), nullable=False),
|
|
sa.Column('email', sa.String(length=120), nullable=False),
|
|
sa.Column('password_hash', sa.String(length=255), nullable=False),
|
|
sa.Column('totp_secret', sa.String(length=32), nullable=True),
|
|
sa.Column('is_2fa_enabled', sa.Boolean(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('last_login', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_user_email'), ['email'], unique=True)
|
|
batch_op.create_index(batch_op.f('ix_user_username'), ['username'], unique=True)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_user_username'))
|
|
batch_op.drop_index(batch_op.f('ix_user_email'))
|
|
|
|
op.drop_table('user')
|
|
# ### end Alembic commands ###
|