CandyRedTele / meatballs

0 stars 0 forks source link

Why is there a type in menu and a category in menu_item? #12

Closed GeoffreyBoom closed 10 years ago

GeoffreyBoom commented 10 years ago

I smell redundancy, they seem to have the same values.

samuelmasuy commented 10 years ago

I agree with this, but since m_id is a primary key you can't have:

m_id type mitem_id
1 wines 1
1 wines 18
1 main 35
1 deserts 52
1 entree 69
2 kids 86
2 wines 13
2 main 30
... ... ...

Even if when you think about it, one menu has many items of different category.

samuelmasuy commented 10 years ago

@GeoffreyBoom do you see a way to associate one menu with multiple menu items while still be able to reference one single menu. update: I think I forgot the table hasMenuItem which actually associates 1 menu with many items. But then what's the purpose of menu, it's definitely redundant.

GeoffreyBoom commented 10 years ago
select menu.m_id, menu_item.name, ingredients.sku, supplies.name 
  from menu, menu_item, ingredients, supplies 
  where ingredients.sku = supplies.sku and 
  menu.mitem_id = menu_item.mitem_id and 
  menu_item.mitem_id = ingredients.mitem_id and
  menu_item.name = "baked-ziti-i" and -- does it for one particular menu item
  menu.m_id = 31 -- does it for one particular menu
  order by menu.m_id;

does the trick, no?

it's a horrible mess though.

GeoffreyBoom commented 10 years ago

That gets the menu with the menu_item s and the sku and the ingredients of baked-ziti-i, for an example.

GeoffreyBoom commented 10 years ago

Oh, I think I see what you're asking now. well, that's interesting... yeah, definitely something wrong there.

GeoffreyBoom commented 10 years ago

We'll definitely need to talk about that tomorrow.

samuelmasuy commented 10 years ago

makes sense to leave this issue open

GeoffreyBoom commented 10 years ago

Accidentally closed it. The close issue button is too easy to click haha

samuelmasuy commented 10 years ago

@GeoffreyBoom true fact