gpt4 book ai didi

node.js - 为 postgresQL 续写 bulkCreate updateOnDuplicate?

转载 作者:行者123 更新时间:2023-11-29 13:10:26 25 4
gpt4 key购买 nike

我知道 Sequelize 不支持 postgresQL 的 updateOnDuplicate sequelize doc ,那么有解决办法吗?

是否可以通过“SQL命令”来实现。

最佳答案

新的 sequelize (v5) 包括所有方言的 updateOnDuplicate 功能

Fields to update if row key already exists (on duplicate key update)? (only supported by MySQL, MariaDB, SQLite >= 3.24.0 & Postgres >= 9.5). By default, all fields are updated.

在这里查看:Docs

你可以使用

model.bulkCreate(dataToUpdate, { updateOnDuplicate: ["user_id", "token", "created_at"] })

关于node.js - 为 postgresQL 续写 bulkCreate updateOnDuplicate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55531860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com