gpt4 book ai didi

sequelize.js - Sequelize Model.bulkInsert 不返回插入的值

转载 作者:行者123 更新时间:2023-12-03 22:25:19 24 4
gpt4 key购买 nike

我有一个包含这段代码的 Sequelize 迁移脚本。

const [recipeCopies, ingredientCopies] = await Promise.all([
queryInterface.bulkInsert('recipe', recipes, {
returning: true,
}),
queryInterface.bulkInsert('ingredient', ingredients, {
returning: true,
}),
]);
console.log(recipeCopies);
documentation of bulkInsert 表示 options of bulkCreate 适用。选项 returning 记录如下。

If true, append RETURNING to get back all defined values; if an array of column names, append RETURNING to get back specific columns (Postgres only)


我传递了 true 所以我希望取回所有定义的值。我返回并注销的只是“24”,即新创建实体的第一个 ID。
我究竟做错了什么?
我正在使用 MySQL 5.7 和 Sequelize 5.21.8。

最佳答案

Sequelize 文档中所述,
MySQL does not support RETURNING 用于 INSERT 语句。它仅适用于 Postgres。

关于sequelize.js - Sequelize Model.bulkInsert 不返回插入的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63685811/

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