模型创建,对数据的操作都建立在模型的基础上
const Sequelize = require('sequelize');
const sequelize = new Sequelize(database...,username,password,{
host:host,
dialect:'mysql',
});
const User = sequelize.define('userinfo...',{
id: {
type: Sequelize.STRING(50),
primaryKey: true//主键
},
username...: Sequelize.STRING,//用户名
password: Sequelize.STRING,//密码 字符串
role: Sequelize.INTEGER,//权限 整数...},{freezeTableName: true,timestamps: false});//timestamp字段表示数据库中是否会自动更新createdAt和updatedAt字段,false表示不会增加这个字段