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:
85
database/migrations/006-create-work-submissions.js
Normal file
85
database/migrations/006-create-work-submissions.js
Normal file
@@ -0,0 +1,85 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 迁移文件:创建作品提交表(work_submissions)
|
||||
* 存储选手上传的作品文件信息
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
const { INTEGER, STRING, DATE } = Sequelize;
|
||||
|
||||
await queryInterface.createTable('work_submissions', {
|
||||
id: {
|
||||
type: INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
allowNull: false,
|
||||
comment: '作品提交唯一标识',
|
||||
},
|
||||
contestant_id: {
|
||||
type: INTEGER,
|
||||
allowNull: false,
|
||||
comment: '选手 ID',
|
||||
references: {
|
||||
model: 'contestants',
|
||||
key: 'id',
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
file_type: {
|
||||
type: STRING(20),
|
||||
allowNull: false,
|
||||
comment: '文件类型(plan/ppt)',
|
||||
},
|
||||
file_name: {
|
||||
type: STRING(200),
|
||||
allowNull: false,
|
||||
comment: '原始文件名',
|
||||
},
|
||||
file_path: {
|
||||
type: STRING(500),
|
||||
allowNull: false,
|
||||
comment: '文件存储路径',
|
||||
},
|
||||
file_size: {
|
||||
type: INTEGER,
|
||||
allowNull: false,
|
||||
comment: '文件大小(字节)',
|
||||
},
|
||||
submit_time: {
|
||||
type: DATE,
|
||||
allowNull: false,
|
||||
comment: '提交时间',
|
||||
},
|
||||
score: {
|
||||
type: INTEGER,
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
comment: '作品得分',
|
||||
},
|
||||
created_at: {
|
||||
type: DATE,
|
||||
allowNull: false,
|
||||
comment: '创建时间',
|
||||
},
|
||||
updated_at: {
|
||||
type: DATE,
|
||||
allowNull: false,
|
||||
comment: '更新时间',
|
||||
},
|
||||
});
|
||||
|
||||
await queryInterface.addIndex('work_submissions', ['contestant_id'], {
|
||||
name: 'idx_work_submissions_contestant_id',
|
||||
});
|
||||
await queryInterface.addIndex('work_submissions', ['file_type'], {
|
||||
name: 'idx_work_submissions_file_type',
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface) => {
|
||||
await queryInterface.dropTable('work_submissions');
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user