"""empty message

Revision ID: b19457d4e7b5
Revises: 76c600a21fcb
Create Date: 2016-07-04 00:39:24.198582

"""

# revision identifiers, used by Alembic.
revision = 'b19457d4e7b5'
down_revision = '76c600a21fcb'

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.add_column('mlmodels', sa.Column('deleted', sa.DateTime(),
                  nullable=True))
    op.add_column('modeltests', sa.Column('deleted', sa.DateTime(),
                  nullable=True))

    op.execute("""
        UPDATE mlmodels SET deleted = updated where status = 'deleted'
    """)

    op.execute("""
        UPDATE modeltests SET deleted = updated where visibility = 'deleted'
    """)


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