user.js 972 Bytes
/*
 * @Author: yangming yangming@didihu.com.cn
 * @Date: 2023-02-27 15:02:57
 * @LastEditors: yangming yangming@didihu.com.cn
 * @LastEditTime: 2023-02-27 15:06:50
 * @FilePath: \achievements-system\app\model\user.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
"use strict";

module.exports = (app) => {
  const { STRING, INTEGER, DATE, NOW } = app.Sequelize;

  const User = app.model.define(
    "user",
    {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true,
      },
      username: STRING,
      password: STRING,
      createDate: {
        type: DATE,
        defaultValue: NOW,
      },
      updateDate: {
        type: DATE,
        defaultValue: NOW,
      },
    },
    {
      timestamps: true,
      createdAt: "createDate",
      updatedAt: "updateDate",
    }
  );
  return User;
};