I'm using sails js with the sails-postgresql adapter
I receive the following error when trying to insert a record into the database.
error: Sending 500 ("Server Error") response:
TypeError: Object.keys called on non-object
at Function.keys (native)
at __CREATE__ (/home/user123/aoresources/node_modules/sails-postgresql/lib/adapter.js:337:16)
config/models.js:
module.exports.models = {
autoCreatedAt: false,
autoUpdatedAt: false,
connection: 'postgresql',
migrate: 'safe',
autoPK: false
};
Table:
create table if not exists users (
id varchar(50) not null primary key,
email varchar(254) not null
);
User.js:
module.exports = {
attributes: {
email: {
type: 'string'
},
id: {
type: 'string',
primaryKey: true
}
}
}
Insert code:
User.create({id: 'test', email:'something'}).exec(function createCB(err,created){});