gpt4 book ai didi

sequelize.js - 为什么我不能在 sequelize-cli 中添加新列?

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

向名为 'vdo' 的表添加新列 'avatar'

我只是创建一个迁移文件并运行它:

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn('vdo', 'avatar', {
type: Sequelize.STRING,
});
},

down: (queryInterface, Sequelize) => {
},
};

但是出现了这样的错误:
Sequelize CLI [Node: 12.16.1, CLI: 5.5.1, ORM: 5.21.11]

Loaded configuration file "database\config.json".
Using environment "development".
(node:9656) [SEQUELIZE0004] DeprecationWarning: A boolean value was passed to options.operatorsAliases. This is a no-op with v5 and should be removed.
== 20200603081223-add-column: migrating =======

ERROR: Table 'vdo.vdo' doesn't exist

最佳答案

只要表名像这样,您就应该指示模式:

addColumn({ schema: '<your_schema_name_here>', tableName: 'vdo' }, 'avatar', ...

关于sequelize.js - 为什么我不能在 sequelize-cli 中添加新列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62168410/

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