javascript - Objection.js Eager 缺少 FROM 子句
问题描述
我正在对 PostGres 使用反对 js,并尝试找到礼物状态为“已关闭”的付款,但我不断收到错误消息:
缺少表的 FROM 子句条目
以下是我的查询。
const payments = await GiftPayments.query()
.eager('gift.[detail, status]')
.where('gift.status.name', 'Closed')
.orderBy('gift.id');
我还尝试了如下所示的 modifyEager,突然状态字段变为空。
const payments = await GiftPayments.query()
.eager('gift.[detail, status]')
.modifyEager('gift', builder =>
{builder.where('name', '=', 'Closed')
})
.orderBy('gift.id');
非常感谢你!
解决方案
似乎“gift”表不在 GiftPayments() 中,或者被别名为“gift”以外的东西。
推荐阅读
- angular - On Key `Enter` 触发活动列表项 Angular 上的单击事件
- c# - 我们应该如何使用异步等待?
- docopt - 为什么这个 docopt 字符串在有或没有可选参数的情况下都不起作用?
- vue.js - Vue-i18n 单文件组件不工作
- node.js - 错误:发送后无法设置标头。在节点 js
- python - 恢复文件 ipynb python
- regex - 接受撇号的电子邮件地址的正则表达式
- google-bigquery - 按周/月//季度/年分区以超过分区限制?
- php - PHPMailer:检查错误是否是身份验证错误
- php - 在更新 Laravel 后使用 Select Dropdown 获取数据的值