szj_roles.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. 'use strict';
  2. module.exports = app => {
  3. const DataTypes = app.Sequelize;
  4. const sequelize = app.model;
  5. const attributes = {
  6. roleId: {
  7. type: DataTypes.INTEGER(10).UNSIGNED,
  8. allowNull: false,
  9. defaultValue: null,
  10. primaryKey: true,
  11. autoIncrement: true,
  12. comment: "角色ID",
  13. field: "role_id"
  14. },
  15. roleDesc: {
  16. type: DataTypes.STRING(255),
  17. allowNull: false,
  18. defaultValue: null,
  19. primaryKey: false,
  20. autoIncrement: false,
  21. comment: "角色描述",
  22. field: "role_desc"
  23. },
  24. roleName: {
  25. type: DataTypes.STRING(20),
  26. allowNull: false,
  27. defaultValue: null,
  28. primaryKey: false,
  29. autoIncrement: false,
  30. comment: "角色名称",
  31. field: "role_name"
  32. },
  33. adminId: {
  34. type: DataTypes.INTEGER(10).UNSIGNED,
  35. allowNull: false,
  36. defaultValue: null,
  37. primaryKey: false,
  38. autoIncrement: false,
  39. comment: "操作管理员",
  40. field: "admin_id"
  41. },
  42. updateTime: {
  43. type: DataTypes.DATE,
  44. allowNull: false,
  45. defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
  46. primaryKey: false,
  47. autoIncrement: false,
  48. comment: "更新时间",
  49. field: "update_time"
  50. },
  51. createTime: {
  52. type: DataTypes.DATE,
  53. allowNull: false,
  54. defaultValue: null,
  55. primaryKey: false,
  56. autoIncrement: false,
  57. comment: "创建时间",
  58. field: "create_time"
  59. }
  60. };
  61. const options = {
  62. tableName: "szj_roles",
  63. comment: "",
  64. indexes: []
  65. };
  66. const SzjRolesModel = sequelize.define("szjRolesModel", attributes, options);
  67. return SzjRolesModel;
  68. };