oms/app/model/user.js

22 lines
790 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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;
};