【问题标题】:Loopback 4 hasMany with composite foreign key (postgres)Loopback 4 hasMany 与复合外键(postgres)
【发布时间】:2019-10-30 05:56:05
【问题描述】:

为了简单起见,我有一个客户 1 -- * 订单

Create table customers (
customer_id int,
offset_id int,
name text,
CONSTRAINT pk_customer_id PRIMARY KEY ( customer_id, offset_id )) 

Create table orders (
id int,
offset_id int,
name text,
customer_id int,
CONSTRAINT pk_order_id PRIMARY KEY ( id, offset_id ),
CONSTRAINT fk_orders_customerid FOREIGN KEY (customer_id, offset_id ) REFERENCES customer (customer_id, offset_id)

有没有办法将订单拉入客户模型?

【问题讨论】:

    标签: loopback4


    【解决方案1】:

    见:

    How to create loopback 4 model, repository and controller without specifying an ID

    总结一下:根据文档,Loopback4 不支持开箱即用的复合键。

    【讨论】:

      猜你喜欢
      • 2012-10-03
      • 1970-01-01
      • 1970-01-01
      • 2015-11-08
      • 2019-03-15
      • 2019-03-26
      • 1970-01-01
      • 2022-01-24
      • 1970-01-01
      相关资源
      最近更新 更多