app-MAIL-temp/migrations/versions/2020_052419_f680032cc361_.py

54 lines
2.2 KiB
Python
Raw Permalink Normal View History

2020-05-24 19:04:01 +02:00
"""empty message
Revision ID: f680032cc361
Revises: 00532ac6d4bc
Create Date: 2020-05-24 19:03:10.209349
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f680032cc361'
down_revision = '00532ac6d4bc'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('fido',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('credential_id', sa.String(), nullable=False),
sa.Column('uuid', sa.String(), nullable=False),
sa.Column('public_key', sa.String(), nullable=False),
sa.Column('sign_count', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=128), nullable=False),
sa.ForeignKeyConstraint(['uuid'], ['users.fido_uuid'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('public_key')
)
op.create_index(op.f('ix_fido_credential_id'), 'fido', ['credential_id'], unique=True)
op.drop_constraint('users_fido_credential_id_key', 'users', type_='unique')
op.drop_constraint('users_fido_pk_key', 'users', type_='unique')
op.drop_column('users', 'fido_sign_count')
op.drop_column('users', 'fido_pk')
op.drop_column('users', 'fido_credential_id')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('fido_credential_id', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('fido_pk', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('fido_sign_count', sa.INTEGER(), autoincrement=False, nullable=True))
op.create_unique_constraint('users_fido_pk_key', 'users', ['fido_pk'])
op.create_unique_constraint('users_fido_credential_id_key', 'users', ['fido_credential_id'])
op.drop_index(op.f('ix_fido_credential_id'), table_name='fido')
op.drop_table('fido')
# ### end Alembic commands ###