我有以下迁移文件,但出现此错误:
TypeError: queryInterface.addConstraint is not a function
谁能告诉我这应该怎么写?
'use strict';
const uuidV4 = require('uuid/v4');
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.createTable('app_users', {
id: {
type: Sequelize.UUID,
primaryKey: true,
defaultValue: function () {
return uuidV4()
}
},
createdAt: {
type: Sequelize.DATE,
allowNull: false
},
updatedAt: {
type: Sequelize.DATE
},
email: {
type: Sequelize.STRING,
allowNull: false
},
disabled: {
type: Sequelize.BOOLEAN,
defaultValue: false,
allowNull: false
}
}).then(function () {
return queryInterface.addConstraint('app_users', ['email'], {
type: 'unique',
name: 'unique_email'
});
})
},
down: function (queryInterface, Sequelize) {
return queryInterface.dropTable('app_users');
}
};
续集[节点:7.10.0,CLI:2.7.0,ORM:4.0.0-2]