how to append item to an array value with Sequelize + PostgreSQL

Viewed 9810

I have a posgresql database, table has a column which is an array: Sequelize.ARRAY(Sequelize.BIGINT).

What is the right way to append a new item to the array?

I am new to posgresql, sequelize and nodejs. May be it is a trivial question. From reading around I think I know how to use Promise.all to read all rows, append, and update back. The question, isn't there any useful shortcut.

PostreSQL documentation mentions a function array_append(anyarray, anyelement).

Sequelize documentation offers a function fn, which Creates an object representing a database function, but only seems to be working in where and order parts

Any way to combine those for an append-like update?

1 Answers
Related