시드 생성
This commit is contained in:
@@ -3,12 +3,12 @@ const { sequelize } = require('../config/database');
|
||||
|
||||
const ClubFeature = sequelize.define('ClubFeature', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
clubId: {
|
||||
type: DataTypes.INTEGER,
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: 'Clubs',
|
||||
@@ -16,7 +16,7 @@ const ClubFeature = sequelize.define('ClubFeature', {
|
||||
}
|
||||
},
|
||||
featureId: {
|
||||
type: DataTypes.INTEGER,
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: 'Features',
|
||||
@@ -45,4 +45,9 @@ const ClubFeature = sequelize.define('ClubFeature', {
|
||||
timestamps: true
|
||||
});
|
||||
|
||||
ClubFeature.associate = (models) => {
|
||||
ClubFeature.belongsTo(models.Club, { foreignKey: 'clubId' });
|
||||
ClubFeature.belongsTo(models.Feature, { foreignKey: 'featureId' });
|
||||
};
|
||||
|
||||
module.exports = ClubFeature;
|
||||
|
||||
Reference in New Issue
Block a user