kikiwie
kikiwie

Reputation: 390

How can i update specific entries in postgres using knex migration

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

Answers (1)

Mikael Lepistö
Mikael Lepistö

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

Related Questions