시드 생성

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
+17 -1
View File
@@ -3,7 +3,7 @@ const { sequelize } = require('../config/database');
const SubscriptionPlan = sequelize.define('SubscriptionPlan', {
id: {
type: DataTypes.INTEGER,
type: DataTypes.INTEGER.UNSIGNED,
primaryKey: true,
autoIncrement: true
},
@@ -33,4 +33,20 @@ const SubscriptionPlan = sequelize.define('SubscriptionPlan', {
timestamps: true
});
SubscriptionPlan.associate = (models) => {
SubscriptionPlan.belongsToMany(models.Club, {
through: models.ClubSubscription,
foreignKey: 'planId',
otherKey: 'clubId',
});
SubscriptionPlan.belongsToMany(models.Feature, {
through: models.SubscriptionPlanFeature,
foreignKey: 'planId',
otherKey: 'featureId',
});
SubscriptionPlan.hasMany(models.ClubSubscription, {
foreignKey: 'planId',
});
};
module.exports = SubscriptionPlan;