"""view_integration

Revision ID: 6a54ba55872e
Revises: 6e834843e7e9
Create Date: 2022-08-25 14:52:44.269082

"""
from alembic import op
import sqlalchemy as sa
import mindsdb.interfaces.storage.db    # noqa


# revision identifiers, used by Alembic.
revision = '6a54ba55872e'
down_revision = '976f15a37e6a'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    with op.batch_alter_table('view', schema=None) as batch_op:
        batch_op.drop_constraint('fk_integration_id', type_='foreignkey')
        batch_op.drop_column('integration_id')

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('view', schema=None) as batch_op:
        batch_op.add_column(sa.Column('integration_id', sa.INTEGER(), autoincrement=False, nullable=False))
        batch_op.create_foreign_key('fk_integration_id', 'integration', ['integration_id'], ['id'])

    # ### end Alembic commands ###
