Picking the best primary key + numbering system

前端 未结 13 1663
盖世英雄少女心
盖世英雄少女心 2020-12-02 14:50

We are trying to come up with a numbering system for the asset system that we are creating, there has been a few heated discussions on this topic in the office so I decided

13条回答
  •  余生分开走
    2020-12-02 15:15

    I'm also very strongly in the "don't use primary keys as meaningful data" camp. Every time I have contravened that policy it has ended in tears. Sooner or later the meaningful data needs to change and if that means you have to change a primary key it can get painful. The primary key will probably be used in foreign key constraints and you can spend ages trying to sort it all out just to make a simple data change.

    I always use GUIDs/UUIDs for my primary keys in every table I ever create but that's just personal preference serials or such are also good.

提交回复
热议问题