Database design for Tagging multiple types of entities

后端 未结 6 2100
抹茶落季
抹茶落季 2021-02-02 04:19

I\'m currently designing a database schema that\'s used to store recipes. In this database there are different types of entities that I want to be able to tag (ingredients, reci

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 04:45

    make tables as normal for recipies, ingredients, etc.

    then your tag table should look this like this: Id, Type, Tag

    I'd recommend using an enum in code to distinguish the different "Types" (entities).

提交回复
热议问题