"""Remove fields from image table that were migrated to imagestorage.

Revision ID: 201d55b38649
Revises: 5a07499ce53f
Create Date: 2014-06-12 19:48:53.861115

"""

# revision identifiers, used by Alembic.
revision = '201d55b38649'
down_revision = '5a07499ce53f'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

def upgrade(tables):
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('buildtriggerservice_name', table_name='buildtriggerservice')
    op.create_index('buildtriggerservice_name', 'buildtriggerservice', ['name'], unique=True)
    op.drop_column('image', 'comment')
    op.drop_column('image', 'checksum')
    op.drop_column('image', 'image_size')
    op.drop_column('image', 'command')
    op.drop_column('image', 'created')
    op.drop_index('logentrykind_name', table_name='logentrykind')
    op.create_index('logentrykind_name', 'logentrykind', ['name'], unique=True)
    op.drop_index('notificationkind_name', table_name='notificationkind')
    op.create_index('notificationkind_name', 'notificationkind', ['name'], unique=True)
    op.drop_index('role_name', table_name='role')
    op.create_index('role_name', 'role', ['name'], unique=True)
    op.drop_index('visibility_name', table_name='visibility')
    op.create_index('visibility_name', 'visibility', ['name'], unique=True)
    ### end Alembic commands ###


def downgrade(tables):
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('visibility_name', table_name='visibility')
    op.create_index('visibility_name', 'visibility', ['name'], unique=False)
    op.drop_index('role_name', table_name='role')
    op.create_index('role_name', 'role', ['name'], unique=False)
    op.drop_index('notificationkind_name', table_name='notificationkind')
    op.create_index('notificationkind_name', 'notificationkind', ['name'], unique=False)
    op.drop_index('logentrykind_name', table_name='logentrykind')
    op.create_index('logentrykind_name', 'logentrykind', ['name'], unique=False)
    op.add_column('image', sa.Column('created', sa.DateTime(), nullable=True))
    op.add_column('image', sa.Column('command', sa.Text(), nullable=True))
    op.add_column('image', sa.Column('image_size', sa.BigInteger(), nullable=True))
    op.add_column('image', sa.Column('checksum', sa.String(length=255), nullable=True))
    op.add_column('image', sa.Column('comment', sa.Text(), nullable=True))
    op.drop_index('buildtriggerservice_name', table_name='buildtriggerservice')
    op.create_index('buildtriggerservice_name', 'buildtriggerservice', ['name'], unique=False)
    ### end Alembic commands ###
