Files
competition-website/app/model/competitionInfo.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

62 lines
1.3 KiB
JavaScript
Raw 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';
/**
* 竞赛信息模型 - CompetitionInfo
*
* 存储竞赛的基本信息,包括竞赛名称和代码。
* 表名:competition_info
*/
module.exports = app => {
const { STRING, INTEGER, DATE } = app.Sequelize;
const CompetitionInfo = app.model.define('competition_info', {
// 主键,自增
competition_uid: {
type: INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '竞赛唯一标识',
},
// 竞赛名称
competition_name: {
type: STRING(200),
allowNull: false,
comment: '竞赛名称',
},
// 竞赛代码(唯一标识码)
competition_code: {
type: STRING(50),
allowNull: false,
unique: true,
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: 'competition_info',
timestamps: false,
underscored: true,
indexes: [
{
unique: true,
fields: ['competition_code'],
},
],
});
return CompetitionInfo;
};