"""Add column is_deleted to Item model

Revision ID: 59a4c44d8f6c
Revises: d4867f3a4c0a
Create Date: 2020-02-06 11:18:09.614707

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '59a4c44d8f6c'
down_revision = 'd4867f3a4c0a'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('item', sa.Column('is_deleted', sa.Boolean(), nullable=True))
    connection = op.get_bind()
    connection.execute('UPDATE item SET is_deleted = false')
    op.alter_column('item', 'is_deleted', nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('item', 'is_deleted')
    # ### end Alembic commands ###
