Files
competition-website/app/model/systemConfig.js
WorkBuddy a303cf2d53 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*、构建/缓存产物。
2026-08-17 12:25:42 +08:00

56 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
/**
* 系统配置模型 - SystemConfig
*
* 存储系统级别的配置项,以键值对形式存储。
* 表名:system_configs
*/
module.exports = app => {
const { STRING, TEXT, INTEGER, DATE } = app.Sequelize;
const SystemConfig = app.model.define('system_config', {
// 主键 ID,自增
id: {
type: INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '配置唯一标识',
},
// 配置键名,唯一
config_key: {
type: STRING(100),
allowNull: false,
unique: true,
comment: '配置键名',
},
// 配置值(文本存储,可存储 JSON 字符串)
config_value: {
type: TEXT,
allowNull: false,
comment: '配置值',
},
// 记录创建时间
created_at: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '创建时间',
},
// 记录更新时间
updated_at: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '更新时间',
},
}, {
tableName: 'system_configs',
timestamps: false,
underscored: true,
});
return SystemConfig;
};