"""test

Revision ID: 05a67001f046
Revises: 2a98ce8fbda7
Create Date: 2021-02-26 14:33:05.153852

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '05a67001f046'
down_revision = '2a98ce8fbda7'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("update cmf_status set orderno=0 where orderno is null")
    op.alter_column('cmf_status', 'orderno',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.execute("update cmf_status set status_type='open' where status_type is null")
    op.alter_column('cmf_status', 'status_type',
               existing_type=sa.VARCHAR(length=32),
               nullable=False)
    op.create_index(op.f('ix_cmf_status_orderno'), 'cmf_status', ['orderno'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cmf_status_orderno'), table_name='cmf_status')
    op.alter_column('cmf_status', 'status_type',
               existing_type=sa.VARCHAR(length=32),
               nullable=True)
    op.alter_column('cmf_status', 'orderno',
               existing_type=sa.INTEGER(),
               nullable=True)
    # ### end Alembic commands ###
