Reputation: 390
I m using knex for my postgres db. I want to update value for a column for specific entries in a selected table in a migration.
I tried
knex('mytable').where('id', 1).update('name', 'test')
and
knex('mytable').where({id: 1}).update({name: 'test'})
but nothing is working.. If you know the way to do so Thanks in advance
Upvotes: 0
Views: 746
Reputation: 19718
Both should work. Make sure that you execute those built queries too:
knex('mytable').where('id', 1).update('name', 'test')
.then(res => console.log("result:", res));
Upvotes: 1