"""empty message

Revision ID: bf5720904ab4
Revises:
Create Date: 2018-10-14 20:11:48.515138

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'bf5720904ab4'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('dispenser',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('index', sa.Integer(), nullable=False),
    sa.Column('position', sa.Integer(), nullable=False),
    sa.Column('type', sa.String(length=10), nullable=True),
    sa.Column('disabled', sa.Boolean(), nullable=False),
    sa.Column('volume', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_dispenser_disabled'), 'dispenser', ['disabled'], unique=False)
    op.create_index(op.f('ix_dispenser_index'), 'dispenser', ['index'], unique=True)
    op.create_index(op.f('ix_dispenser_position'), 'dispenser', ['position'], unique=True)
    op.create_index(op.f('ix_dispenser_type'), 'dispenser', ['type'], unique=False)
    op.create_table('drink',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ref', sa.String(length=36), nullable=False),
    sa.Column('name', sa.String(length=15), nullable=False),
    sa.Column('alcoholic', sa.Boolean(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_drink_alcoholic'), 'drink', ['alcoholic'], unique=False)
    op.create_index(op.f('ix_drink_name'), 'drink', ['name'], unique=True)
    op.create_table('ingredient',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ref', sa.String(length=36), nullable=False),
    sa.Column('name', sa.String(length=15), nullable=False),
    sa.Column('alcoholic', sa.Boolean(), nullable=False),
    sa.Column('abs', sa.Integer(), nullable=True),
    sa.Column('dispenser_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['dispenser_id'], ['dispenser.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_ingredient_alcoholic'), 'ingredient', ['alcoholic'], unique=False)
    op.create_index(op.f('ix_ingredient_name'), 'ingredient', ['name'], unique=True)
    op.create_table('drink_component',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ingredient_id', sa.Integer(), nullable=False),
    sa.Column('measure', sa.Integer(), nullable=False),
    sa.Column('drink_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['drink_id'], ['drink.id'], ),
    sa.ForeignKeyConstraint(['ingredient_id'], ['ingredient.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('drink_component')
    op.drop_index(op.f('ix_ingredient_name'), table_name='ingredient')
    op.drop_index(op.f('ix_ingredient_alcoholic'), table_name='ingredient')
    op.drop_table('ingredient')
    op.drop_index(op.f('ix_drink_name'), table_name='drink')
    op.drop_index(op.f('ix_drink_alcoholic'), table_name='drink')
    op.drop_table('drink')
    op.drop_index(op.f('ix_dispenser_type'), table_name='dispenser')
    op.drop_index(op.f('ix_dispenser_position'), table_name='dispenser')
    op.drop_index(op.f('ix_dispenser_index'), table_name='dispenser')
    op.drop_index(op.f('ix_dispenser_disabled'), table_name='dispenser')
    op.drop_table('dispenser')
    # ### end Alembic commands ###
