|
| 1 | +"""add 2fa functionality |
| 2 | +
|
| 3 | +Revision ID: b5b86c536020 |
| 4 | +Revises: 98911b881230 |
| 5 | +Create Date: 2021-10-20 01:10:15.944795 |
| 6 | +
|
| 7 | +""" |
| 8 | +from alembic import op |
| 9 | +import sqlalchemy as sa |
| 10 | +from sqlalchemy.dialects import postgresql |
| 11 | + |
| 12 | +# revision identifiers, used by Alembic. |
| 13 | +revision = 'b5b86c536020' |
| 14 | +down_revision = '98911b881230' |
| 15 | +branch_labels = None |
| 16 | +depends_on = None |
| 17 | + |
| 18 | + |
| 19 | +def upgrade(): |
| 20 | + # ### commands auto generated by Alembic - please adjust! ### |
| 21 | + op.create_table( |
| 22 | + 'tfatokens', |
| 23 | + sa.Column('id', sa.Integer(), nullable=False), |
| 24 | + sa.Column('uuid', postgresql.UUID(as_uuid=True), nullable=False), |
| 25 | + sa.Column('user_id', sa.Integer(), nullable=False), |
| 26 | + sa.Column('value', sa.Text(), nullable=False), |
| 27 | + sa.Column('expires', sa.DateTime(), nullable=False), |
| 28 | + sa.Column('secret', sa.Text(), nullable=True), |
| 29 | + sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_tfatokens_user_id_users')), |
| 30 | + sa.PrimaryKeyConstraint('id', name=op.f('pk_tfatokens')), |
| 31 | + sa.UniqueConstraint('uuid', name=op.f('uq_tfatokens_uuid')), |
| 32 | + sa.UniqueConstraint('value', name=op.f('uq_tfatokens_value')) |
| 33 | + ) |
| 34 | + op.add_column('users', sa.Column('tfa_secret', sa.Text(), nullable=True)) |
| 35 | + # ### end Alembic commands ### |
| 36 | + |
| 37 | + |
| 38 | +def downgrade(): |
| 39 | + # ### commands auto generated by Alembic - please adjust! ### |
| 40 | + op.drop_column('users', 'tfa_secret') |
| 41 | + op.drop_table('tfatokens') |
| 42 | + # ### end Alembic commands ### |
0 commit comments