0

I'm using sequelize and PostgreSQL and trying to do a simple update via migrations that finds a specific value and udpates it. I have achieved alter table migrations without problem, I must be missing something simple, I can confirm I have a myTable and there is a field named "name" and an entry has a value of "bob".

queryInterface.sequelize.query(`UPDATE 'myTable' SET name = 'bob' WHERE name = 'fred'`)

This is the error I am getting

Unhandled rejection SequelizeDatabaseError: syntax error at or near "'myTable'"
edencorbin
  • 2,569
  • 5
  • 29
  • 44

1 Answers1

1

Should it not be

queryInterface.sequelize.query(`UPDATE myTable SET name = 'bob' WHERE name = 'fred'`)

Single quotes are for proper strings, you could double quotes though. This answer has more info

Shivam
  • 3,462
  • 1
  • 15
  • 20