import { DataTypes } from 'sequelize';
import sequelize from '../database.js';
import Member from './Member.js';
import TrainingGroup from './TrainingGroup.js';

const MemberTrainingGroup = sequelize.define('MemberTrainingGroup', {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        allowNull: false,
    },
    memberId: {
        type: DataTypes.INTEGER,
        allowNull: false,
        references: {
            model: Member,
            key: 'id',
        },
        onDelete: 'CASCADE',
    },
    trainingGroupId: {
        type: DataTypes.INTEGER,
        allowNull: false,
        references: {
            model: TrainingGroup,
            key: 'id',
        },
        onDelete: 'CASCADE',
    }
}, {
    tableName: 'member_training_group',
    underscored: true,
    timestamps: true,
});

export default MemberTrainingGroup;



