"""empty message

Revision ID: ff38a18013c9
Revises: <PASSWORD>
Create Date: 2020-07-05 20:37:33.846056

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ff38a18013c9'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('tasks', schema=None) as batch_op:
        batch_op.drop_index('ix_tasks_name')

    op.drop_table('tasks')
    with op.batch_alter_table('crawls', schema=None) as batch_op:
        batch_op.add_column(sa.Column('taskid', sa.String(length=125), nullable=True))

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('crawls', schema=None) as batch_op:
        batch_op.drop_column('taskid')

    op.create_table('tasks',
    sa.Column('id', sa.VARCHAR(length=36), nullable=False),
    sa.Column('name', sa.VARCHAR(length=128), nullable=True),
    sa.Column('crawl_id', sa.INTEGER(), nullable=True),
    sa.Column('complete', sa.BOOLEAN(), nullable=True),
    sa.CheckConstraint('complete IN (0, 1)'),
    sa.ForeignKeyConstraint(['crawl_id'], ['crawls.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    with op.batch_alter_table('tasks', schema=None) as batch_op:
        batch_op.create_index('ix_tasks_name', ['name'], unique=False)

    # ### end Alembic commands ###
