'use strict'; /** * 示例 Model,演示 egg-sequelize 用法,可删除后按业务创建。 * 目录约定:app/model/** 下每个文件导出 define 的 model, * 通过 app.model.xxx 访问(此处文件名为 user.js => app.model.User)。 * @param {Egg.Application} app egg application * @return {object} user model */ module.exports = app => { const { STRING, INTEGER, DATE } = app.Sequelize; const User = app.model.define('user', { id: { type: INTEGER, primaryKey: true, autoIncrement: true, comment: '主键' }, name: { type: STRING(50), allowNull: false, comment: '用户名' }, created_at: { type: DATE, allowNull: false, comment: '创建时间' }, updated_at: { type: DATE, allowNull: false, comment: '更新时间' }, }); return User; };