'use strict'; module.exports = { async up(queryInterface, Sequelize) { await queryInterface.createTable('notification_broadcasts', { broadcast_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true }, uuid: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, allowNull: false, unique: true }, title: { type: Sequelize.STRING(255), allowNull: false }, message: { type: Sequelize.TEXT, allowNull: false }, audience: { type: Sequelize.ENUM('admin', 'user', 'both'), allowNull: false }, status: { type: Sequelize.ENUM('draft', 'sent', 'archived'), allowNull: false, defaultValue: 'draft' }, sent_at: { type: Sequelize.DATE, allowNull: true }, recipient_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, createdBy: { type: Sequelize.BIGINT, allowNull: true }, updatedBy: { type: Sequelize.BIGINT, allowNull: true }, deletedBy: { type: Sequelize.BIGINT, allowNull: true }, createdAt: { type: Sequelize.DATE, allowNull: false }, updatedAt: { type: Sequelize.DATE, allowNull: false }, deletedAt: { type: Sequelize.DATE, allowNull: true }, }); await queryInterface.addIndex('notification_broadcasts', ['uuid']); await queryInterface.addIndex('notification_broadcasts', ['status']); await queryInterface.addIndex('notification_broadcasts', ['audience']); await queryInterface.addIndex('notification_broadcasts', ['deletedAt']); }, async down(queryInterface) { await queryInterface.dropTable('notification_broadcasts'); }, };