You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.2 KiB

  1. 'use strict'
  2. /**
  3. * Document schema
  4. */
  5. module.exports = (sequelize, DataTypes) => {
  6. let documentSchema = sequelize.define('setting', {
  7. path: {
  8. type: DataTypes.STRING,
  9. allowNull: false
  10. },
  11. title: {
  12. type: DataTypes.STRING,
  13. allowNull: false,
  14. validate: {
  15. len: [2, 255]
  16. }
  17. },
  18. subtitle: {
  19. type: DataTypes.STRING,
  20. allowNull: true,
  21. defaultValue: ''
  22. },
  23. parentPath: {
  24. type: DataTypes.STRING,
  25. allowNull: true,
  26. defaultValue: ''
  27. },
  28. parentTitle: {
  29. type: DataTypes.STRING,
  30. allowNull: true,
  31. defaultValue: ''
  32. },
  33. isDirectory: {
  34. type: DataTypes.BOOLEAN,
  35. allowNull: false,
  36. defaultValue: false
  37. },
  38. isEntry: {
  39. type: DataTypes.BOOLEAN,
  40. allowNull: false,
  41. defaultValue: false
  42. },
  43. isDraft: {
  44. type: DataTypes.BOOLEAN,
  45. allowNull: false,
  46. defaultValue: false
  47. },
  48. searchContent: {
  49. type: DataTypes.TEXT,
  50. allowNull: true,
  51. defaultValue: ''
  52. }
  53. }, {
  54. timestamps: true,
  55. version: true,
  56. indexes: [
  57. {
  58. unique: true,
  59. fields: ['path']
  60. }
  61. ]
  62. })
  63. return documentSchema
  64. }