【发布时间】:2016-04-10 18:53:26
【问题描述】:
正如我在文档中所读到的“Waterline 将查看您的模型,如果它发现两个模型都具有指向彼此的集合属性,它将自动为您构建一个连接表。”我的问题是水线如何知道哪个表是关联表,因为我现在遇到错误
where 子句中的未知列
NaN
我使用 MYSQL 作为数据库,我的模型如下所示:
Sells.js:
module.exports = {
autoCreatedAt: true,
autoUpdatedAt: false,
attributes: {
createdAt:{
type:'datetime',
columnName:'created'
},
qty_sold:{
type:'float'
},
s_notes:{
type:'string'
},
items: {
collection: 'species',
via: 'sales',
dominant:true
}
}
};
物种.js:
module.exports = {
autoCreatedAt: false,
autoUpdatedAt: false,
attributes: {
name:{
type:'string',
},
qty:{
type:'float',
},
sort:{
type:'float',
},
quickbooks_listid:{
type:'string'
},
quickbooks_editsequence:{
type:'string'
},
isEdited:{
type:'integer'
},
cut_fish:{
type:'integer'
},
// Add a reference to Sells
sales: {
collection: 'sells',
via: 'items',
//dominant: true
}
}
};
我在 mysql DB 中有 2 个现有表: 品种和销售
【问题讨论】: