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:
94
database/migrations/004-create-aggregation.js
Normal file
94
database/migrations/004-create-aggregation.js
Normal file
@@ -0,0 +1,94 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('aggregation', {
|
||||
aggregation_uid: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
allowNull: false,
|
||||
comment: '报名记录唯一标识',
|
||||
},
|
||||
competition_uid: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
comment: '赛事ID(关联competition_info)',
|
||||
references: { model: 'competition_info', key: 'competition_uid' },
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
team_uid: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
comment: '团队ID(关联teams)',
|
||||
references: { model: 'teams', key: 'team_uid' },
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
account_uid: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
comment: '用户ID(关联accounts)',
|
||||
references: { model: 'accounts', key: 'uid' },
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
identity: {
|
||||
type: Sequelize.STRING(32),
|
||||
allowNull: true,
|
||||
comment: '身份标识',
|
||||
},
|
||||
is_registrant: {
|
||||
type: Sequelize.TINYINT,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '是否为主要报名人:0否 1是',
|
||||
},
|
||||
registration_form: {
|
||||
type: Sequelize.STRING(512),
|
||||
allowNull: true,
|
||||
comment: '报名表文件路径',
|
||||
},
|
||||
stamped_form: {
|
||||
type: Sequelize.STRING(512),
|
||||
allowNull: true,
|
||||
comment: '盖章报名表文件路径',
|
||||
},
|
||||
audit_status: {
|
||||
type: Sequelize.STRING(32),
|
||||
allowNull: false,
|
||||
defaultValue: 'pending',
|
||||
comment: '审核状态:pending/approved/rejected',
|
||||
},
|
||||
reject_reason: {
|
||||
type: Sequelize.STRING(512),
|
||||
allowNull: true,
|
||||
comment: '驳回原因',
|
||||
},
|
||||
created_at: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
|
||||
comment: '创建时间',
|
||||
},
|
||||
updated_at: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
|
||||
comment: '更新时间',
|
||||
},
|
||||
}).then(() => {
|
||||
return Promise.all([
|
||||
queryInterface.addIndex('aggregation', ['competition_uid'], { name: 'idx_competition_uid' }),
|
||||
queryInterface.addIndex('aggregation', ['team_uid'], { name: 'idx_team_uid' }),
|
||||
queryInterface.addIndex('aggregation', ['account_uid'], { name: 'idx_account_uid' }),
|
||||
queryInterface.addIndex('aggregation', ['audit_status'], { name: 'idx_audit_status' }),
|
||||
]);
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('aggregation');
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user