"""empty message

Revision ID: c5cba727841a
Revises: bad4bacc8493
Create Date: 2017-05-02 14:24:26.478286

"""
from alembic import op
import sqlalchemy as sa
from stand.migration_utils import is_psql, is_sqlite


# revision identifiers, used by Alembic.
revision = 'c5cba727841a'
down_revision = 'bad4bacc8493'
branch_labels = None
depends_on = None


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('execution_permission',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('permission', sa.Enum('STOP', 'MANAGE', 'LIST', 'EXECUTE', name='PermissionTypeEnumType'), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column(u'job_result', sa.Column('content', sa.Text(), nullable=True))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job_result') as batch_op:
            batch_op.drop_column('content')
    else:
        op.drop_column('job_result', 'content')
    op.drop_table('execution_permission')
    if is_psql():
        op.get_bind().execute('DROP TYPE "PermissionTypeEnumType"')
    ### end Alembic commands ###
