Do link tables need a meaningless primary key field?

前端 未结 12 1529
你的背包
你的背包 2020-12-08 14:05

I am working on a couple of link tables and I got to thinking (Danger Will Robinson, Danger) what are the possible structures of a link table and what are their pro\'s and c

12条回答
  •  被撕碎了的回忆
    2020-12-08 14:52

    If this is a true many-to-many join table, then dump unecessary id column (unless your ORM requires one. in that case you've got to decide whether your intellect is going to trump your practicality).

    But I find that true join tables are pretty rare. It usually isn't long before I start wanting to put some other data in that table. Because of that I almost always model these join tables as entities from the beginning and stick an id in there.

提交回复
热议问题