"""Create Inventory table

Revision ID: 82d2df03d7aa
Revises: a3d4659850d8
Create Date: 2021-02-04 11:56:46.659488

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '82d2df03d7aa'
down_revision = 'a3d4659850d8'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    inventory_table = op.create_table('inventories',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ingredient_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('food_item', sa.String(), nullable=True),
    sa.Column('quantity', sa.Float(), nullable=False),
    sa.Column('market_price', sa.Float(), nullable=True),
    sa.ForeignKeyConstraint(['ingredient_id'], ['ingredients.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###
    op.bulk_insert(inventory_table,[
        {"ingredient_id":1, "user_id":1, "food_item": "Lettuce", "quantity":250, "market_price":.05},
        {"ingredient_id":2, "user_id":1, "food_item": "Bun", "quantity":183, "market_price":.80},
        {"ingredient_id":3, "user_id":1, "food_item": "Patty", "quantity":181, "market_price":1.25},
        {"ingredient_id":4, "user_id":1, "food_item": "Pickle", "quantity":270, "market_price":.35},
        {"ingredient_id":5, "user_id":1, "food_item": "Tomato", "quantity":52, "market_price":.30},
        {"ingredient_id":6, "user_id":1, "food_item": "Bacon", "quantity":28, "market_price":.99},
        {"ingredient_id":7, "user_id":1, "food_item": "Beer", "quantity":280, "market_price":1.00},
        {"ingredient_id":8, "user_id":1, "food_item": "Chicken", "quantity":43, "market_price":1.50},
        {"ingredient_id":9, "user_id":1, "food_item": "Coke", "quantity":412, "market_price":.15},
    ])

# inventories1 = Inventory(
#         user_id = 1,
#         ingredient_id = 1,
#         food_item = "Lettuce",
#         quantity = 250,
#         market_price = 00.05
#     )

#     inventories2 = Inventory(
#         user_id = 1,
#         ingredient_id = 2,
#         food_item = "Bun",
#         quantity = 183,
#         market_price = 00.80
#     )

#     inventories3 = Inventory(
#         user_id = 1,
#         ingredient_id = 3,
#         food_item = "Patty",
#         quantity = 181,
#         market_price = 1.25
#     )

#     inventories4 = Inventory(
#         user_id = 1,
#         ingredient_id = 4,
#         food_item = 'Pickle',
#         quantity = 270,
#         market_price = 00.35
#     )

#     inventories5 = Inventory(
#         user_id = 1,
#         ingredient_id = 5,
#         food_item = "Tomato",
#         quantity = 52,
#         market_price = 00.30
#     )

#     inventories6 = Inventory(
#         user_id = 1,
#         ingredient_id = 6,
#         food_item = "Bacon",
#         quantity = 28,
#         market_price = 00.99
#     )
#     inventories7 = Inventory(
#         user_id = 1,
#         ingredient_id = 7,
#         food_item = "Beer",
#         quantity = 280,
#         market_price = 01.00
#     )
#     inventories8 = Inventory(
#         user_id = 1,
#         ingredient_id = 8,
#         food_item = "Chicken",
#         quantity = 43,
#         market_price = 01.50
#     )
#     inventories9 = Inventory(
#         user_id = 1,
#         ingredient_id = 9,
#         food_item = "Coke",
#         quantity = 412,
#         market_price = 00.15
#     )

def downgrade():
    pass
    # ### commands auto generated by Alembic - please adjust! ###
    # op.drop_table('inventories')
    # ### end Alembic commands ###
