'use strict'; /** * 文档栏目(doc_sections) * * 文档站最外层(顶部 tab),栏目下面**直接**就是内容页 —— 只有两级,不再有分类。 * - `code`:URL 片段(`/doc//`),**创建后不能改**(改了旧链接就失效) * - `status`:1 展示 0 隐藏(隐藏后不生成页面,也不再进 sitemap) * - `sort`:栏目顺序(小的在前) */ module.exports = (app) => { const { BIGINT, STRING, TINYINT, INTEGER } = app.Sequelize; const DocSection = app.model.define('doc_section', { id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键' }, code: { type: STRING(32), allowNull: false, unique: true, comment: 'URL 片段(/doc//)' }, name: { type: STRING(64), allowNull: false, comment: '栏目名称(顶部 tab 文案)' }, description: { type: STRING(255), allowNull: true, comment: '栏目说明(可选)' }, sort: { type: INTEGER.UNSIGNED, allowNull: false, defaultValue: 0, comment: '排序(小的在前)' }, status: { type: TINYINT.UNSIGNED, allowNull: false, defaultValue: 1, comment: '状态:1 展示 0 隐藏' }, }, { tableName: 'doc_sections', paranoid: true, comment: '文档栏目表', }); return DocSection; };