"""Migrate quota

Revision ID: 47df965c128
Revises: 23d8efcd529
Create Date: 2015-06-10 16:19:08.578366

"""

# revision identifiers, used by Alembic.
revision = '47df965c128'
down_revision = '23d8efcd529'
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():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('quote', sa.Column('name', sa.String(length=32), nullable=True))
    op.add_column('quote', sa.Column('value', sa.Integer(), nullable=True))
    # op.drop_index('customer_id', table_name='quote')
    op.create_unique_constraint(None, 'quote', ['customer_id', 'name'])
    op.drop_column('quote', 'maxServerMeta')
    op.drop_column('quote', 'maxTotalKeypairs')
    op.drop_column('quote', 'maxSecurityGroups')
    op.drop_column('quote', 'maxServerGroups')
    op.drop_column('quote', 'maxTotalCores')
    op.drop_column('quote', 'maxPersonality')
    op.drop_column('quote', 'maxTotalInstances')
    op.drop_column('quote', 'maxImageMeta')
    op.drop_column('quote', 'maxTotalSnapshots')
    op.drop_column('quote', 'maxTotalVolumeGigabytes')
    op.drop_column('quote', 'maxServerGroupMembers')
    op.drop_column('quote', 'maxPersonalitySize')
    op.drop_column('quote', 'maxSecurityGroupRules')
    op.drop_column('quote', 'maxTotalVolumes')
    op.drop_column('quote', 'maxTotalRAMSize')
    op.drop_column('quote', 'maxTotalFloatingIps')
    ### end Alembic commands ###


def downgrade_account():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('quote', sa.Column('maxTotalFloatingIps', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxTotalRAMSize', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxTotalVolumes', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxSecurityGroupRules', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxPersonalitySize', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxServerGroupMembers', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxTotalVolumeGigabytes', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxTotalSnapshots', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxImageMeta', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxTotalInstances', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxPersonality', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxTotalCores', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxServerGroups', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxSecurityGroups', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxTotalKeypairs', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('quote', sa.Column('maxServerMeta', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'quote', type_='unique')
    op.create_index('customer_id', 'quote', ['customer_id'], unique=True)
    op.drop_column('quote', 'value')
    op.drop_column('quote', 'name')
    ### end Alembic commands ###


def upgrade_fitter():
    pass


def downgrade_fitter():
    pass

