我正在开发一个用于网络管理的自定义故障单系统,并尝试为以下场景找到最佳的数据库表布局:
有表示无源光网络、T1和T3线路的表。每一行可能有一个或多个故障单,但每个故障单都有一些唯一的字段,这取决于该tiket所属的线路类型。
以下是我的方法:
pon:
pon_id, pk
....
#here other unique pon table columns
t1:
t1_id, pk
....
#here other unique t1 table columns
t3:
t3_id, pk
....
#here other unique t3 table columns
ticket:
ticket_id, pk
type, string # t1, t3, pon
type_id, int # id of pon, t1 or t3
....
#here other columns, which are common for all ticket types
ticket_pon_type:
ticket_id, pk, fk
....
#here unique pon ticket columns
ticket_t1_type:
ticket_id, pk, fk
....
#here unique t1 ticket columns
ticket_t3_type:
ticket_id, pk, fk
....
#here unique t3 ticket columns我正在使用Symfony 1.4 PHP框架和Doctrine ORM构建我的应用程序。
还有其他想法吗?谢谢你的帮助。
发布于 2010-04-15 06:16:26
pon、t1和t3应该合并到一个表中。向表中添加一个line列,这样您就可以知道每条记录是pon、t1还是t3。
我想您会发现这也允许您合并您的ticket_type表。
https://stackoverflow.com/questions/2641443
复制相似问题