gpt4 book ai didi

node.js - "error": "relation\"Issueds\"does not exist"

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

我正在尝试插入到我已经拥有的表中,但是 sequelize 给我一个错误,表名已更改
表名 = 已发布

{
"status": 500,
"error": "relation \"Issueds\" does not exist"
}

最佳答案

默认情况下,Sequelize 将表名复数化。
只需在模型配置对象中启用 freezeTableName :

在您的模型定义中:

module.exports = (sequelize, DataTypes) => {
const Issued = sequelize.define(
'Issued',
{
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true
},
// Any other fields ...
},
{
freezeTableName: true // This will prevent the name's pluralization.
}
});

关于node.js - "error": "relation\"Issueds\"does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59970244/

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