@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
// Re-categorizes advertisement placements: Hero stays on Dashboard, Banner
|
||||
// consolidates onto Tier Plans + Course Details. Popup (dashboard.popup) and
|
||||
// Sidebar (course_details.sidebar) are retired as formats, and the Courses
|
||||
// list banner (course_list.banner) is dropped along with them since the new
|
||||
// registry only offers Dashboard / Tier Plans / Course Details.
|
||||
//
|
||||
// Existing rows on a retired placement are archived (soft-deleted) rather
|
||||
// than deleted outright — they still show up in Archived Advertisements for
|
||||
// an admin to review/permanently delete if desired.
|
||||
const RETIRED_PLACEMENTS = ['dashboard.popup', 'course_list.banner', 'course_details.sidebar'];
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface) {
|
||||
await queryInterface.sequelize.query(`
|
||||
UPDATE advertisements SET placement = 'tier_plans.banner' WHERE placement = 'plans.banner'
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
UPDATE advertisements
|
||||
SET "deletedAt" = NOW()
|
||||
WHERE placement IN (:retired) AND "deletedAt" IS NULL
|
||||
`, {
|
||||
replacements: { retired: RETIRED_PLACEMENTS },
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
await queryInterface.sequelize.query(`
|
||||
UPDATE advertisements SET placement = 'plans.banner' WHERE placement = 'tier_plans.banner'
|
||||
`);
|
||||
// Retired-placement rows that were auto-archived by `up` are intentionally
|
||||
// left archived — there's no reliable way to distinguish them from ads an
|
||||
// admin archived manually in the meantime.
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user