'use strict'; module.exports = { async up(queryInterface, Sequelize) { await queryInterface.addColumn('email_templates', 'category', { type: Sequelize.ENUM('announcement', 'advertisement', 'system', 'other'), allowNull: false, defaultValue: 'other', }); // The 8 built-in (is_system) templates are all account/auth notifications. await queryInterface.sequelize.query(` UPDATE email_templates SET category = 'system' WHERE is_system = true; `); }, async down(queryInterface) { await queryInterface.removeColumn('email_templates', 'category'); await queryInterface.sequelize.query(`DROP TYPE IF EXISTS "enum_email_templates_category";`); }, };