【发布时间】:2021-05-05 03:18:37
【问题描述】:
有没有办法让 Sails 中的主键为负整数? 我在测试一些旧软件时遇到了以下错误;
{
"code":"E_INVALID_VALUES_TO_SET",
"details":"Could not use specified `org`. Expecting an id representing the associated record, or `null` to indicate there will be no associated record. But the specified value is not a valid `org`. Cannot use a negative number (-1) as a primary key value.",
"message":"The server could not fulfill this request (`PATCH /user/1402`) due to a problem with the parameters that were sent. See the `details` for more info. **The following additional tip will not be shown in production**: Tip: Check your client-side code to make sure that the request data it sends matches the expectations of the corresponding attribues in your model. Also check that your client-side code sends data for every required attribute."}
我检查了 Sails 文档,找不到任何提到不允许负主键的地方。
我还检查了两个表的架构定义,都没有将相关字段指定为无符号。
除了将相关行更改为某个不同的 id 并更新引用它的所有其他行之外,还有其他解决方法吗?
【问题讨论】:
标签: sails.js