mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
32 lines
1.6 KiB
JavaScript
32 lines
1.6 KiB
JavaScript
'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');
|
|
},
|
|
};
|