mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
26 lines
1.3 KiB
JavaScript
26 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.createTable('admin_notifications', {
|
|
notification_id: { type: Sequelize.BIGINT, primaryKey: true, autoIncrement: true },
|
|
type: { type: Sequelize.STRING(64), allowNull: false },
|
|
title: { type: Sequelize.STRING(255), allowNull: false },
|
|
message: { type: Sequelize.TEXT, allowNull: false },
|
|
data: { type: Sequelize.JSONB, allowNull: true, defaultValue: null },
|
|
seen: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false },
|
|
seen_at: { type: Sequelize.DATE, allowNull: true, defaultValue: null },
|
|
createdAt: { type: Sequelize.DATE, allowNull: false },
|
|
updatedAt: { type: Sequelize.DATE, allowNull: false },
|
|
});
|
|
|
|
await queryInterface.addIndex('admin_notifications', { fields: ['seen'], name: 'idx_an_seen' });
|
|
await queryInterface.addIndex('admin_notifications', { fields: ['type'], name: 'idx_an_type' });
|
|
await queryInterface.addIndex('admin_notifications', { fields: ['createdAt'], name: 'idx_an_created_at' });
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.dropTable('admin_notifications');
|
|
},
|
|
};
|