"""Support preemptibles

Revision ID: 72f7db0e7dfe
Revises: 43dc3aacd80e
Create Date: 2020-05-21 10:43:00.687089

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '72f7db0e7dfe'
down_revision = '43dc3aacd80e'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('trial', sa.Column('preempted', sa.Boolean(), nullable=True))
    op.execute('UPDATE trial SET preempted = false WHERE preempted IS NULL')
    op.alter_column('trial', 'preempted', nullable=False)

    op.add_column('trial', sa.Column('preemptible', sa.Boolean(), nullable=True))
    op.execute('UPDATE trial SET preemptible = false WHERE preemptible IS NULL')
    op.alter_column('trial', 'preemptible', nullable=False)

    # ### end Alembic commands ###


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