我正尝试通过片段迁移脚本向多个表添加单列isDeleted
,如代码段所示。
module.exports = {
up: (queryInterface, Sequelize) => {
queryInterface.addColumn(
['category', 'products', 'orders', 'purchases'],
'isDeleted',
{
type: Sequelize.BOOLEAN,
},
)
},
down: queryInterface =>
queryInterface.removeColumn(
['category', 'products', 'orders', 'purchases'],
'isDeleted',
),
}
当我使用sequelize db:migrate
运行此脚本时,出现错误
== 20181212035825-add-column-for-deleted-items: migrating =======
ERROR: s.replace is not a function
有没有办法可以做到这一点?我一直在使用此资源作为参考 https://sequelize.readthedocs.io/en/latest/docs/migrations/