Files
starr-philproperties/database/migrations/20260703000007-add-markdown-source-to-email-templates.js
T
kennethobsequio 1d12f04967 new commits
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
2026-07-03 16:20:58 +08:00

25 lines
1.0 KiB
JavaScript

'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
// The admin editor now authors in Markdown (converted client-side to the
// HTML that subject/html_body already require) — these columns retain the
// original Markdown purely so reopening a template for editing shows the
// human-readable source again instead of the compiled HTML. Templates
// created before this migration (all 8 system templates included) have
// no Markdown source — html_body/draft_html_body remain hand-written HTML
// for them, and the editor falls back to editing that directly.
await queryInterface.addColumn('email_templates', 'body_markdown', {
type: Sequelize.TEXT, allowNull: true,
});
await queryInterface.addColumn('email_templates', 'draft_body_markdown', {
type: Sequelize.TEXT, allowNull: true,
});
},
async down(queryInterface) {
await queryInterface.removeColumn('email_templates', 'draft_body_markdown');
await queryInterface.removeColumn('email_templates', 'body_markdown');
},
};