Questions tagged «polymorphic-associations»

1
加强约束“两张桌子”
我在用SQL建模电气原理图时遇到了一些麻烦。我想捕捉的结构是 part ←────────── pin ↑ ↑ part_inst ←───── pin_inst 其中“实例”是“实例”的缩写。 例如,作为partLM358运算放大器,我可能具有pins 1OUT,1IN-,1IN +,GND,2IN +,2IN-,2OUT和V CC。然后,我可能将此零件放在原理图上,并创建一个part_inst和8 pin_insts。 忽略数据字段,我最初对模式的尝试是 create table parts ( part_id bigserial primary key ); create table pins ( pin_id bigserial primary key, part_id bigint not null references parts ); create table part_insts ( part_inst_id bigserial primary key, part_id …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.