大家好,我是 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 文件
最佳答案
所以我用谷歌搜索了几天,这是答案: 连接到数据库时,运算符别名必须设置为 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/