9cb38e5bc8
Build and Push Docker Images Staging / build (push) Successful in 34s
- Remove html-shell entries from InitialSchema Seed() method - Create new AddHtmlShellTemplates migration to insert html-shell templates - Prevents duplicate key errors from having same data in two migrations - InitialSchema seeds 32 templates (16 keys × 2 languages) - AddHtmlShellTemplates seeds 2 html-shell templates (start, end) - Total: 34 templates after both migrations run Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
46 lines
2.9 KiB
C#
46 lines
2.9 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Email.Data;
|
|
|
|
#nullable disable
|
|
|
|
namespace Email.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddHtmlShellTemplates : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
// HTML email shell — opening tags (blue header, white card container)
|
|
migrationBuilder.InsertData(
|
|
table: "Templates",
|
|
columns: new[] { "Key", "Language", "Value", "Description" },
|
|
values: new object[] { "email.html-shell.start", "*", "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif; margin: 0; padding: 0; background-color: #f5f5f5; }\n .email-container { max-width: 600px; margin: 0 auto; background-color: #ffffff; }\n .email-header { background-color: #2c5282; color: white; padding: 24px; text-align: center; }\n .email-header h1 { margin: 0; font-size: 24px; font-weight: 600; }\n .email-body { padding: 24px; }\n .email-footer { background-color: #f8f9fa; padding: 16px; text-align: center; color: #6c757d; font-size: 12px; border-top: 1px solid #dee2e6; }\n </style>\n</head>\n<body>\n <div class=\"email-container\">\n <div class=\"email-header\">\n <h1>MyAi.ro</h1>\n </div>\n <div class=\"email-body\">\n", "Opening HTML wrapper for branded emails (blue header, white content area)" },
|
|
schema: MigrationConstants.SchemaName);
|
|
|
|
// HTML email shell — closing tags (footer)
|
|
migrationBuilder.InsertData(
|
|
table: "Templates",
|
|
columns: new[] { "Key", "Language", "Value", "Description" },
|
|
values: new object[] { "email.html-shell.end", "*", " </div>\n <div class=\"email-footer\">\n <p>© 2026 MyAi.ro. All rights reserved.</p>\n </div>\n </div>\n</body>\n</html>\n", "Closing HTML wrapper for branded emails (footer and closing tags)" },
|
|
schema: MigrationConstants.SchemaName);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DeleteData(
|
|
table: "Templates",
|
|
keyColumns: new[] { "Key", "Language" },
|
|
keyValues: new object[] { "email.html-shell.start", "*" },
|
|
schema: MigrationConstants.SchemaName);
|
|
|
|
migrationBuilder.DeleteData(
|
|
table: "Templates",
|
|
keyColumns: new[] { "Key", "Language" },
|
|
keyValues: new object[] { "email.html-shell.end", "*" },
|
|
schema: MigrationConstants.SchemaName);
|
|
}
|
|
}
|
|
}
|