<reponame>boerniee/project-mate<filename>migrations/versions/b073314db20f_added_otp.py
"""added otp

Revision ID: <KEY>
Revises: 84d40eea5067
Create Date: 2020-09-12 23:36:35.961964

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '84d40eea5067'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('invoice', schema=None) as batch_op:
        batch_op.alter_column('sent',
               existing_type=sa.BOOLEAN(),
               nullable=True)

    with op.batch_alter_table('product', schema=None) as batch_op:
        batch_op.drop_index('ix_product_price')
        batch_op.drop_column('price')
        batch_op.drop_column('stock')
        batch_op.drop_column('stock_active')

    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.add_column(sa.Column('otp_count', sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column('otp_secret', sa.String(length=16), nullable=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_column('otp_secret')
        batch_op.drop_column('otp_count')

    with op.batch_alter_table('product', schema=None) as batch_op:
        batch_op.add_column(sa.Column('stock_active', sa.BOOLEAN(), nullable=True))
        batch_op.add_column(sa.Column('stock', sa.INTEGER(), nullable=True))
        batch_op.add_column(sa.Column('price', sa.FLOAT(), nullable=True))
        batch_op.create_index('ix_product_price', ['price'], unique=False)

    with op.batch_alter_table('invoice', schema=None) as batch_op:
        batch_op.alter_column('sent',
               existing_type=sa.BOOLEAN(),
               nullable=False)

    # ### end Alembic commands ###

"""added otp

Revision ID: <KEY>
Revises: 84d40eea5067
Create Date: 2020-09-12 23:36:35.961964

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '84d40eea5067'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('invoice', schema=None) as batch_op:
        batch_op.alter_column('sent',
               existing_type=sa.BOOLEAN(),
               nullable=True)

    with op.batch_alter_table('product', schema=None) as batch_op:
        batch_op.drop_index('ix_product_price')
        batch_op.drop_column('price')
        batch_op.drop_column('stock')
        batch_op.drop_column('stock_active')

    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.add_column(sa.Column('otp_count', sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column('otp_secret', sa.String(length=16), nullable=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_column('otp_secret')
        batch_op.drop_column('otp_count')

    with op.batch_alter_table('product', schema=None) as batch_op:
        batch_op.add_column(sa.Column('stock_active', sa.BOOLEAN(), nullable=True))
        batch_op.add_column(sa.Column('stock', sa.INTEGER(), nullable=True))
        batch_op.add_column(sa.Column('price', sa.FLOAT(), nullable=True))
        batch_op.create_index('ix_product_price', ['price'], unique=False)

    with op.batch_alter_table('invoice', schema=None) as batch_op:
        batch_op.alter_column('sent',
               existing_type=sa.BOOLEAN(),
               nullable=False)

    # ### end Alembic commands ###
added otp  Revision ID: <KEY> Revises: 84d40eea5067 Create Date: 2020-09-12 23:36:35.961964 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###