For now I update my table accounts with accountId and it's working perfectly.
return models.sequelize.query("UPDATE \"accounts\" " +
"SET \"accountId\" = "+newAccount.id+" " +
"WHERE \"accountId\" = "+oldAccount.id+";").spread(function(){
return 'success';
});
What if I want to change not only accountId, but, say, the date. How should I write it then? I've tried writing it with the comma
"SET \"accountId\" = "+ newAccount.id+",\"date\" + newAccount.date + " WHERE...
but that doesn't seem to work.
Appreciate your help.
UPDATE: in console I get this message
[2015-10-25 16:42:00.909] [TRACE] main - Executing (default): UPDATE "accounts" SET "date" = Sun Oct 25 2015 16:42:00 GMT+0300 (MSK) WHERE "date" = Sun Oct 25 2015 16:41:53 GMT+0300 (MSK); but after that I don't get any 'success' message (data didn't change in db). May it happen because of data type? I have 'timestamp with time zone' in my postgresql database.
I guess, here can be the same problem
UPDATE "accounts" SET "accountId" = (new_value), "date" = (new_value) WHERE "accountId" = (value), "date" = (value);, but it doesn't work at all: even accountID doesn't update.query("UPDATE a SET b = :id", {replacements: {id: "123"}});