【发布时间】:2021-10-29 05:26:53
【问题描述】:
我想使用 Sequelize 迁移来更新我的 Postgres 数据库中的表。
我的 SQL 查询使用来自 Postgres 的 de ? 运算符作为 JSONB 列。
我需要运行的 SQL 查询是:
UPDATE messages SET type = 'products' WHERE type = 'gallery' and content ? '%textMain%'
我在 Sequelize 中的迁移如下所示:
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.bulkUpdate(
'messages',
{ type: 'products' },
// HERE GOES THE WHERE CLAUSE
)
},
down: async (_queryInterface, _Sequelize) => {
}
};
【问题讨论】:
标签: node.js postgresql sequelize.js