"""Added deferred table

Revision ID: 36759675584
Revises: 514c4c54871
Create Date: 2015-06-01 17:23:46.973664

"""

# revision identifiers, used by Alembic.
revision = '36759675584'
down_revision = '514c4c54871'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


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.create_table('deferred',
    sa.Column('deferred_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('customer_id', sa.Integer(), nullable=True),
    sa.Column('tariff_id', sa.Integer(), nullable=True),
    sa.Column('date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['customer_id'], ['customer.customer_id'], ),
    sa.ForeignKeyConstraint(['tariff_id'], ['tariff.tariff_id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.user_id'], ),
    sa.PrimaryKeyConstraint('deferred_id'),
    sa.UniqueConstraint('customer_id')
    )
    op.create_index(op.f('ix_deferred_date'), 'deferred', ['date'], unique=False)
    ### end Alembic commands ###


def downgrade_account():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_deferred_date'), table_name='deferred')
    op.drop_table('deferred')
    ### end Alembic commands ###


def upgrade_fitter():
    pass


def downgrade_fitter():
    pass

