시드 생성

This commit is contained in:
2025-04-24 12:01:51 +09:00
parent beac42d60c
commit 7fa99e6988
42 changed files with 938 additions and 1170 deletions
+14 -5
View File
@@ -3,12 +3,12 @@ const { sequelize } = require('../config/database');
const EventScore = sequelize.define('EventScore', {
id: {
type: DataTypes.INTEGER,
type: DataTypes.INTEGER.UNSIGNED,
primaryKey: true,
autoIncrement: true
},
eventId: {
type: DataTypes.INTEGER,
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
references: {
model: 'Events',
@@ -16,7 +16,7 @@ const EventScore = sequelize.define('EventScore', {
}
},
participantId: {
type: DataTypes.INTEGER,
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
references: {
model: 'EventParticipants',
@@ -24,11 +24,11 @@ const EventScore = sequelize.define('EventScore', {
}
},
teamNumber: {
type: DataTypes.INTEGER,
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true,
},
gameNumber: {
type: DataTypes.INTEGER,
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false
},
score: {
@@ -49,4 +49,13 @@ const EventScore = sequelize.define('EventScore', {
timestamps: true
});
EventScore.associate = (models) => {
EventScore.belongsTo(models.Event, {
foreignKey: 'eventId'
});
EventScore.belongsTo(models.EventParticipant, {
foreignKey: 'participantId'
});
};
module.exports = EventScore;