chore: 后端首次基线提交

运行必须源码:app/(controller/model/service/middleware/lib/utils/validate/router)、config/、database/(migrations/seeders/sql)、启动脚本、app/public/templates 模板。
已忽略运行非必须:node_modules/、logs/、run/、app/public 运行时上传数据、.env*、构建/缓存产物。
This commit is contained in:
WorkBuddy
2026-08-17 12:25:42 +08:00
commit a303cf2d53
109 changed files with 25904 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
'use strict';
/**
* 为 carousel 表新增富文本正文与可配置按钮字段,并放宽 image_url 允许为空
* (支持"渐变底图回退"的固定页迁移)。
*
* 新增:
* - content TEXT 富文本正文(HTML,由 wangEditor 生成,前端 v-html 渲染)
* - button_text VARCHAR(100) 按钮文字(为空则不显示按钮)
* - button_link VARCHAR(500) 按钮链接(内部路由如 /activate,或外部 http(s):// 链接)
* 变更:
* - image_url 由 NOT NULL 放宽为 允许 NULL(无底图时前端回退 CSS 渐变)
*/
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn('carousel', 'content', {
type: Sequelize.TEXT,
allowNull: true,
defaultValue: null,
comment: '富文本正文(HTML)',
after: 'title',
});
await queryInterface.addColumn('carousel', 'button_text', {
type: Sequelize.STRING(100),
allowNull: true,
defaultValue: null,
comment: '按钮文字(为空则不显示按钮)',
after: 'content',
});
await queryInterface.addColumn('carousel', 'button_link', {
type: Sequelize.STRING(500),
allowNull: true,
defaultValue: null,
comment: '按钮链接(内部路由/外部URL)',
after: 'button_text',
});
// 放宽 image_url 允许为空,支持渐变底图回退
await queryInterface.changeColumn('carousel', 'image_url', {
type: Sequelize.STRING(500),
allowNull: true,
defaultValue: null,
comment: '图片 URL 地址(可为空时前端回退渐变)',
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeColumn('carousel', 'content');
await queryInterface.removeColumn('carousel', 'button_text');
await queryInterface.removeColumn('carousel', 'button_link');
await queryInterface.changeColumn('carousel', 'image_url', {
type: Sequelize.STRING(500),
allowNull: false,
comment: '图片 URL 地址',
});
},
};