在遵循Sequelize的文档时,我使用sequelize
对象创建了用户模型。
const Sequelize = require("sequelize");
const Model = Sequelize.Model;
const path = "mysql://user:password@localhost:3306/test_db";
const sequelize = new Sequelize(path, {
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
});
const User = sequelize.define('user', {
firstName: {
type: Sequelize.STRING,
allowNull: false
},
lastName: {
type: Sequelize.STRING
}
}, {});
代码运行正常,但是问题是VS Code中的Intellisense没有建议任何功能
来自sequelize
对象,如下所示:
这是一种错误还是我编写了错误的代码?
答案 0 :(得分:1)
只需使用大括号将Sequelize导入到您的实用程序文件
const { Sequelize } = require('sequelize');