From 706851f39654fa0c39ee5ca346d48028afdd9a9b Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Sat, 31 Jan 2026 20:21:17 -0600 Subject: [PATCH] fix: add migration to update existing tier change template (refs #59) The original migration already inserted the template with Handlebars conditionals. This migration updates the existing record to use simple variable substitution. Co-Authored-By: Claude Opus 4.5 --- .../008_fix_tier_change_template.sql | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 backend/src/features/notifications/migrations/008_fix_tier_change_template.sql diff --git a/backend/src/features/notifications/migrations/008_fix_tier_change_template.sql b/backend/src/features/notifications/migrations/008_fix_tier_change_template.sql new file mode 100644 index 0000000..31878be --- /dev/null +++ b/backend/src/features/notifications/migrations/008_fix_tier_change_template.sql @@ -0,0 +1,26 @@ +/** + * Migration: Fix subscription tier change email template + * @ai-summary Fixes template to use simple variable substitution instead of conditionals + * @ai-context TemplateService only supports {{variable}}, not Handlebars conditionals + */ + +-- Update the existing template to use simple variable substitution +UPDATE email_templates +SET + body = 'Hi {{userName}}, + +Your MotoVaultPro subscription has been {{changeType}}. + +Previous Tier: {{previousTier}} +New Tier: {{newTier}} +Reason: {{reason}} + +{{additionalInfo}} + +If you have any questions, please contact support. + +Best regards, +MotoVaultPro Team', + variables = '["userName", "changeType", "previousTier", "newTier", "reason", "additionalInfo"]', + updated_at = NOW() +WHERE template_key = 'subscription_tier_change';