【发布时间】:2017-07-19 22:39:23
【问题描述】:
我有以下架构(这是一种方法):
CONTACTS
--------
|id |
|name |--------------------------
-------- \ \
| \ \
| \ \
^ ^ ^
PHONE_NUMBERS ADDRESSES EMAILS
-------------- -------------- --------------
|id | |id | |id |
|FK(contacts)| |FK(contacts)| |FK(contacts)|
|preferred | |preferred | |preferred |
|type | |type | |type |
|inserted_at | |inserted_at | |inserted_at |
| ---------- | | ---------- | | ---------- |
|phone_no | |address | |email |
-------------- |city | --------------
|(...) |
我想出的另外两个解决方案是 (1) inheritence 和 (2) 将它们全部倾倒在一张桌子上,这可能是最丑陋的。 (或者也许我在做一些根本错误的事情。)
【问题讨论】:
标签: postgresql database-schema