Files
starr-philproperties/apps/api/database/migrations/20270101000084-add-image-asset-id-to-notifications.js
T

28 lines
918 B
JavaScript

'use strict';
// Per-alert layout image, replacing the old shared sticky_banner_settings
// singleton (see 20270101000066-create-sticky-banner-settings.js) — each
// notification_broadcasts row now carries its own optional image, copied
// onto admin_notifications/user_notifications at send time the same way
// color/show_in_sticky already are.
const TABLES = ['notification_broadcasts', 'admin_notifications', 'user_notifications'];
module.exports = {
async up(queryInterface, Sequelize) {
for (const table of TABLES) {
await queryInterface.addColumn(table, 'image_asset_id', {
type: Sequelize.BIGINT,
allowNull: true,
references: { model: 'assets', key: 'asset_id' },
onDelete: 'SET NULL',
});
}
},
async down(queryInterface) {
for (const table of TABLES) {
await queryInterface.removeColumn(table, 'image_asset_id');
}
},
};