"""add status to issue

Revision ID: 6d3439e14660
Revises: 04c84d5e2a21
Create Date: 2019-03-22 07:57:32.625406

"""
from alembic import op
import sqlalchemy as sa
from pabu.tools import get_table

# revision identifiers, used by Alembic.
revision = '6d3439e14660'
down_revision = '04c84d5e2a21'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('issues', sa.Column('status', sa.String(), nullable=True))

    issues = get_table(op.get_bind(), 'issues')
    op.execute(issues.update().values(status = 'todo'))

    op.alter_column('issues', 'status', nullable=False)
    # ### end Alembic commands ###


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



