export async function up(queryInterface, Sequelize) { await queryInterface.createTable('members', { id: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true, }, userId: { type: Sequelize.INTEGER, references: { model: 'users', key: 'id', }, onUpdate: 'CASCADE', onDelete: 'CASCADE', }, projectId: { type: Sequelize.INTEGER, references: { model: 'projects', key: 'id', }, onUpdate: 'CASCADE', onDelete: 'CASCADE', }, role: { type: Sequelize.INTEGER, allowNull: false, }, createdAt: { type: Sequelize.DATE, allowNull: false, }, updatedAt: { type: Sequelize.DATE, allowNull: false, }, }); await queryInterface.addIndex('members', ['userId', 'projectId'], { unique: true, }); } export async function down(queryInterface) { await queryInterface.dropTable('members'); }