gpt4 book ai didi

javascript - 运行迁移时 Sequelize 已弃用错误消息

转载 作者:行者123 更新时间:2023-12-01 01:57:59 24 4
gpt4 key购买 nike

大家好,我是 Sequelize 和 Node js 的初学者,我读过他们的官方文档,读过他们的github,搜索过博客文章,但无法解决。我不断收到警告消息:

GMT sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators at node_modules/sequelize/lib/sequelize.js:236:13

此错误仅在运行迁移时发生,但在我正常启动服务器时不会发生

这是我的connection.js 文件

https://pastebin.com/5NKfExib

最佳答案

所以我用谷歌搜索了几天,这是答案:连接到数据库时,运算符别名必须设置为 false,如下所示:

 sequelize = new Sequelize(config.database, config.username, config.password, Object.assign({}, config, {
pool: dbConst.pool,
operatorsAliases: false,
})

此外,在migrations.config.json中,operatorAliases必须设置为false并且在您的代码中始终使用 Sequalize.Op

关于javascript - 运行迁移时 Sequelize 已弃用错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50859897/

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