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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah double quotes, strange I thought I had tried that, any all working, thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.