I am trying to create a model using Waterline ORM & sails.js for a postgresql db. I have a model defined like this.
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'
}
}
});
The table corresponding to the model gets created in the DB, but other than the default generated id, createdAt & updatedAt columns, no other column is reflected.
When my config is pointing to the localdiskdb, this seems to work fine. It's happening when I change the endpoint to a postgres instance running on AWS.
Any ideas ?
Update: I was able to resolve this. Instead of extending waterline, I used the conventional sails model format.
module.exports = {
identity: 'item',
connection: 'postgresqlServer',
attributes: {
title: {
type: 'text'
},
brand: {
type: 'text',
defaultsTo: 'Other'
},
description: {
type: 'text'
},
category: {
type: 'text'
}
}
}