egg sequelize 更新表结构问题
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利
// eslint-disable-next-line strict
module.exports = app => {
const { STRING, INTEGER, DATE } = app.Sequelize;
const CustomEvent = app.model.define('custom_event', {
id: { type: INTEGER, primaryKey: true, autoIncrement: true },
type: STRING(30),
custom: STRING(30),
project_id: INTEGER,
created_at: DATE,
updated_at: DATE,
});
// 定义好model 后需要使用sync 来进行同步
CustomEvent.sync({ force: true });
return CustomEvent
};