我正在尝试使用 Waterline ORM &sails.js 为 postgresql 数据库创建模型。我有一个这样定义的模型。
var Waterline = require('waterline');
var Item = Waterline.Collection.extend({
identity: 'item',
connection: 'postgresqlServer',
attributes: {
title: {
type: 'text'
},
brand: {
type: 'text',
defaultsTo: 'Other'
},
description: {
type: 'text'
},
category: {
type: 'text'
}
}
});
在数据库中创建了模型对应的表,但除了默认生成的 id、createdAt 和 updatedAt 列之外,没有其他列被反映。
当我的配置指向 localdiskdb 时,这似乎工作正常。当我将端点更改为在 AWS 上运行的 postgres 实例时,就会发生这种情况。
有任何想法吗 ?
更新:我能够解决这个问题。我没有延长吃水线,而是使用了传统的帆模型格式。
module.exports = {
identity: 'item',
connection: 'postgresqlServer',
attributes: {
title: {
type: 'text'
},
brand: {
type: 'text',
defaultsTo: 'Other'
},
description: {
type: 'text'
},
category: {
type: 'text'
}
}
}