B
B
Bogdan2019-08-12 12:00:43
PostgreSQL
Bogdan, 2019-08-12 12:00:43

Sequelize (PostgreSQL) alias on update?

Hello. Please tell me how to do it on Sequelize using the PostgreSQL database, when updating for the returned fields, you need to make alias.

UPDATE "Cartridges" SET "quantity" = 50  WHERE "id" = 2 returning id, code as codeCartridge

Request, returns simply all fields.
const cartridge = await models.Cartridge.update( { quantity }, { returning: true, where: { id } } );

Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question