edencorbin
edencorbin

Reputation: 2949

sequelize postgresql update migration

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'"

Upvotes: 0

Views: 217

Answers (1)

Shivam
Shivam

Reputation: 3622

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

Upvotes: 1

Related Questions