我在使用 Sequelize 时遇到了一个我以前从未遇到过的奇怪问题,当我尝试运行迁移时没有任何反应。我得到以下输出:
Loaded configuration file "config\config.json"
Using environment "development"
Run Code Online (Sandbox Code Playgroud)
该程序刚刚存在。
我已经多次检查我的代码,一切都检查出来了。
型号代码:
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable("users", {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
username: {
type: Sequelize.STRING,
unique: true,
allowNull: false,
validate: {
notEmpty: true
}
},
email: {
type: Sequelize.STRING,
unique: true,
allowNull: false,
validate: {
notEmpty: true,
isEmail: true
}
},
password: {
type: Sequelize.STRING,
allowNull: false,
validate: {
notEmpty: true,
len: [7, 42]
}
}, …Run Code Online (Sandbox Code Playgroud)