"""Update service_usage table

Revision ID: 236ad45a9e4
Revises: 58bbe565915
Create Date: 2015-07-21 17:36:46.119212

"""

# revision identifiers, used by Alembic.
revision = '236ad45a9e4'
down_revision = '58bbe565915'
branch_labels = None
depends_on = None

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

def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_account():
    op.add_column('service_usage', sa.Column('resource_id', sa.Text(), nullable=True))
    op.alter_column('service_usage', 'volume',
               existing_type=mysql.INTEGER(display_width=11),
               type_=sa.BigInteger(),
               existing_nullable=True)
    op.alter_column('service_usage', 'usage_volume',
               existing_type=mysql.INTEGER(display_width=11),
               type_=sa.BigInteger(),
               existing_nullable=True)
    op.drop_index('ix_service_usage_usage_volume', table_name='service_usage')
    op.drop_column('service_usage', 'service_name')
    ### end Alembic commands ###


def downgrade_account():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('service_usage', sa.Column('service_name', mysql.TEXT(), nullable=True))
    op.create_index('ix_service_usage_usage_volume', 'service_usage', ['usage_volume'], unique=False)
    op.drop_column('service_usage', 'resource_id')
    ### end Alembic commands ###


def upgrade_fitter():
    pass


def downgrade_fitter():
    pass

