Im pretty new for sails, I'm trying to create an authentication scheme in my postgresql db.
I have a user model
module.exports = {
attributes: {
firstName: {
type: 'string'
},
lastName: {
type: 'string'
},
email: {
type: 'string',
required: true,
unique: true
},
password: {
type: 'string',
required: true
},
authTokens: {
collection: 'authToken',
via: 'owner'
}
}
}
and user registration / creation controller
module.exports = {
create: function (req, res) {
sails.log.info("Message to be logged");
User.create(
{
email: req.body.email,
firstName: req.body.firstName,
lastName: req.body.lastName,
password: req.body.password
}
).exec(function (err) {
if (err) {
return res.status(400).send({err: err});
} else {
return res.status(200).send({message: "it is okay"});
}
});
}
}
Now, when im uses the localDiskDb adapter by default, it works, the user is created using the create method . When I changed the default data source in datastores.js to
default: {
adapter: 'sails-postgresql',
host: 'mydbserver.rds.amazonaws.com',
user: 'myDbRoot',
password: 'pass',
database: 'myDbName'
}
I see tables being created in my database . But when I try to call the create method, it returns an error:
AdapterError: Unexpected error from database adapter: no parameter $ 1
I use these versions of sails packages:
"sails": "^1.0.0-30",
"sails-hook-grunt": "^1.0.4",
"sails-hook-orm": "^2.0.0-0",
"sails-hook-sockets": "^1.0.1",
"sails-postgresql": "1.0.0-1",
Does anyone have any ideas?