'use strict'; module.exports = { async up(queryInterface, Sequelize) { await queryInterface.createTable('plan_courses', { id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true }, plan_id: { type: Sequelize.BIGINT, allowNull: false, references: { model: 'tier_plans', key: 'plan_id' }, onDelete: 'CASCADE' }, course_id: { type: Sequelize.BIGINT, allowNull: false, unique: true, references: { model: 'courses', key: 'course_id' }, onDelete: 'CASCADE' }, createdAt: { type: Sequelize.DATE, allowNull: false }, updatedAt: { type: Sequelize.DATE, allowNull: false }, }); await queryInterface.addIndex('plan_courses', ['plan_id']); }, async down(queryInterface) { await queryInterface.dropTable('plan_courses'); }, };