"""empty message

Revision ID: 0ffe14caed20
Revises: 3bb1a4c5b7da
Create Date: 2021-03-16 21:17:53.292841

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0ffe14caed20'
down_revision = '3bb1a4c5b7da'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('subs', schema=None) as batch_op:
        batch_op.add_column(sa.Column('coin_id', sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column('user_id', sa.Integer(), nullable=True))
        batch_op.drop_constraint('fk_subs_id_coin', type_='foreignkey')
        batch_op.create_foreign_key(batch_op.f('fk_subs_coin_id_coin'), 'coin', ['coin_id'], ['id'])
        batch_op.create_foreign_key(batch_op.f('fk_subs_user_id_user'), 'user', ['user_id'], ['id'])
        batch_op.drop_column('id')

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('subs', schema=None) as batch_op:
        batch_op.add_column(sa.Column('id', sa.INTEGER(), nullable=True))
        batch_op.drop_constraint(batch_op.f('fk_subs_user_id_user'), type_='foreignkey')
        batch_op.drop_constraint(batch_op.f('fk_subs_coin_id_coin'), type_='foreignkey')
        batch_op.create_foreign_key('fk_subs_id_coin', 'coin', ['id'], ['id'])
        batch_op.drop_column('user_id')
        batch_op.drop_column('coin_id')

    # ### end Alembic commands ###
