sys_user.js 902 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const { DataTypes } = require('sequelize');
  2. const connect = require('./connect');
  3. /*
  4. type: DataTypes.STRING,
  5. allowNull: false,
  6. defaultValue:'',
  7. comment: '名',
  8. */
  9. const model = connect.define(
  10. __filename.slice(__dirname.length + 1).replace('.js', ''),
  11. {
  12. id: {
  13. type: DataTypes.BIGINT,
  14. autoIncrement: true,
  15. primaryKey: true,
  16. comment: 'id',
  17. },
  18. login: {
  19. type: DataTypes.STRING,
  20. allowNull: false,
  21. defaultValue: '',
  22. comment: '名',
  23. },
  24. phoneNumber: {
  25. type: DataTypes.STRING,
  26. comment: '头像',
  27. },
  28. userType: {
  29. type: DataTypes.STRING,
  30. comment: '头像',
  31. },
  32. },
  33. {
  34. comment: '用户',
  35. timestamps: false,
  36. hooks: {
  37. beforeFind(option) {
  38. if (!option.order) {
  39. option.order = [['id', 'desc']];
  40. }
  41. },
  42. },
  43. }
  44. );
  45. module.exports = model;