"""empty message

Revision ID: 8c5a3ad38a4a
Revises: 82c208c2ff38
Create Date: 2020-08-11 17:42:17.558137

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from stand.migration_utils import is_sqlite

# revision identifiers, used by Alembic.
revision = '8c5a3ad38a4a'
down_revision = '82c208c2ff38'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    if is_sqlite():
        with op.batch_alter_table('cluster') as batch_op:
            batch_op.alter_column('auth_token', nullable=True)
            batch_op.alter_column('general_parameters', nullable=True)
        with op.batch_alter_table('job') as batch_op:
            batch_op.add_column(sa.Column('job_key', sa.String(length=200), nullable=True))
    else:
        op.alter_column('cluster', 'auth_token',
               existing_type=mysql.VARCHAR(collation='utf8_unicode_ci', length=1000),
               nullable=True)
        op.alter_column('cluster', 'general_parameters',
               existing_type=mysql.VARCHAR(collation='utf8_unicode_ci', length=2000),
               nullable=True)
        op.add_column('job', sa.Column('job_key', sa.String(length=200), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    if is_sqlite():
        with op.batch_alter_table('job') as batch_op:
            batch_op.drop_column('job_key')
    else:
        # Keeps columns auth_token and general_parameters as nullable 
        op.drop_column('job', 'job_key')
    # ### end Alembic commands ###
