"""Add subscription and subscription_switch tables

Revision ID: 44d3aa89e8c
Revises: 2c7b4a4d337
Create Date: 2015-05-29 14:38:31.376192

"""

# revision identifiers, used by Alembic.
revision = '44d3aa89e8c'
down_revision = '2c7b4a4d337'
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('subscription',
    sa.Column('subscription_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=16), nullable=True),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.Column('customer_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['customer_id'], ['customer.customer_id'], ),
    sa.PrimaryKeyConstraint('subscription_id'),
    sa.UniqueConstraint('customer_id', 'name', 'email')
    )
    op.create_table('subscription_switch',
    sa.Column('confirmation_id', sa.Integer(), nullable=False),
    sa.Column('enable', sa.Boolean(), nullable=True),
    sa.Column('name', sa.String(length=16), nullable=True),
    sa.Column('customer_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['customer_id'], ['customer.customer_id'], ),
    sa.PrimaryKeyConstraint('confirmation_id'),
    sa.UniqueConstraint('customer_id', 'name')
    )
    ### end Alembic commands ###


def downgrade_account():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('subscription_switch')
    op.drop_table('subscription')
    ### end Alembic commands ###


def upgrade_fitter():
    pass


def downgrade_fitter():
    pass

