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.

64 lines
1.2 KiB

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