From dc3051f44740d35623586c04c4256b458bc05db6 Mon Sep 17 00:00:00 2001 From: claude Date: Mon, 1 Jun 2026 16:31:05 +0300 Subject: [PATCH] Consolidate all migrations into single InitialSchema migrations Deleted all incremental migrations and regenerated fresh InitialSchema migrations that contain the complete, correct schema from the start: - CvMatcher: InitialSchema with 3-column unique constraint on Results (CvDocumentId, JobDocumentId, Language) - Email: InitialSchema with Templates table (consolidated from EmailTemplates) This creates a cleaner migration history and faster fresh deployments. Since there is no production data, consolidation is safe and improves maintainability. Co-Authored-By: Claude Haiku 4.5 --- ...7140442_InitialCvMatcherSchema.Designer.cs | 95 --------- ...335_AddLanguageToCvMatchResult.Designer.cs | 99 --------- ...260524140335_AddLanguageToCvMatchResult.cs | 32 --- .../20260528110000_AddAiPrompts.Designer.cs | 130 ------------ .../Migrations/20260528110000_AddAiPrompts.cs | 50 ----- ...ateCvMatchSystemPromptKeywords.Designer.cs | 130 ------------ ...40000_UpdateCvMatchSystemPromptKeywords.cs | 49 ----- ...esultsUniqueConstraintToIncludeLanguage.cs | 60 ------ ... 20260601133028_InitialSchema.Designer.cs} | 4 +- ...ema.cs => 20260601133028_InitialSchema.cs} | 42 +++- ...528100000_CreateEmailTemplates.Designer.cs | 69 ------- .../20260528100000_CreateEmailTemplates.cs | 191 ------------------ ...60528130652_SeedEmailTemplates.Designer.cs | 69 ------- .../20260528130652_SeedEmailTemplates.cs | 178 ---------------- ...1132154_RenameEmailTemplatesToTemplates.cs | 28 --- ... 20260601133043_InitialSchema.Designer.cs} | 4 +- .../20260601133043_InitialSchema.cs | 43 ++++ .../Migrations/EmailDbContextModelSnapshot.cs | 4 +- 18 files changed, 80 insertions(+), 1197 deletions(-) delete mode 100644 Apis/cv-matcher-data/Migrations/20260507140442_InitialCvMatcherSchema.Designer.cs delete mode 100644 Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.Designer.cs delete mode 100644 Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.cs delete mode 100644 Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.Designer.cs delete mode 100644 Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.cs delete mode 100644 Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.Designer.cs delete mode 100644 Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.cs delete mode 100644 Apis/cv-matcher-data/Migrations/20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.cs rename Apis/cv-matcher-data/Migrations/{20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.Designer.cs => 20260601133028_InitialSchema.Designer.cs} (96%) rename Apis/cv-matcher-data/Migrations/{20260507140442_InitialCvMatcherSchema.cs => 20260601133028_InitialSchema.cs} (62%) delete mode 100644 Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.Designer.cs delete mode 100644 Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.cs delete mode 100644 Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.Designer.cs delete mode 100644 Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.cs delete mode 100644 Apis/email-data/Migrations/20260601132154_RenameEmailTemplatesToTemplates.cs rename Apis/email-data/Migrations/{20260601132154_RenameEmailTemplatesToTemplates.Designer.cs => 20260601133043_InitialSchema.Designer.cs} (95%) create mode 100644 Apis/email-data/Migrations/20260601133043_InitialSchema.cs diff --git a/Apis/cv-matcher-data/Migrations/20260507140442_InitialCvMatcherSchema.Designer.cs b/Apis/cv-matcher-data/Migrations/20260507140442_InitialCvMatcherSchema.Designer.cs deleted file mode 100644 index 42ef9a7..0000000 --- a/Apis/cv-matcher-data/Migrations/20260507140442_InitialCvMatcherSchema.Designer.cs +++ /dev/null @@ -1,95 +0,0 @@ -// -using System; -using CvMatcher.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - [DbContext(typeof(CvMatcherDbContext))] - [Migration("20260507140442_InitialCvMatcherSchema")] - partial class InitialCvMatcherSchema - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("cvMatcher") - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatchResultEntity", b => - { - b.Property("Id") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("CvDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("JobDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("ResultJson") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Score") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CvDocumentId", "JobDocumentId") - .IsUnique(); - - b.ToTable("Results", "cvMatcher"); - }); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatcherChatCacheEntity", b => - { - b.Property("CacheKey") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Model") - .IsRequired() - .HasMaxLength(120) - .HasColumnType("nvarchar(120)"); - - b.Property("ResponseText") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Temperature") - .HasColumnType("decimal(4,2)"); - - b.HasKey("CacheKey"); - - b.ToTable("ChatCache", "cvMatcher"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.Designer.cs b/Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.Designer.cs deleted file mode 100644 index 74d8293..0000000 --- a/Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.Designer.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -using System; -using CvMatcher.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - [DbContext(typeof(CvMatcherDbContext))] - [Migration("20260524140335_AddLanguageToCvMatchResult")] - partial class AddLanguageToCvMatchResult - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("cvMatcher") - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatchResultEntity", b => - { - b.Property("Id") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("CvDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("JobDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("Language") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ResultJson") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Score") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CvDocumentId", "JobDocumentId") - .IsUnique(); - - b.ToTable("Results", "cvMatcher"); - }); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatcherChatCacheEntity", b => - { - b.Property("CacheKey") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Model") - .IsRequired() - .HasMaxLength(120) - .HasColumnType("nvarchar(120)"); - - b.Property("ResponseText") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Temperature") - .HasColumnType("decimal(4,2)"); - - b.HasKey("CacheKey"); - - b.ToTable("ChatCache", "cvMatcher"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.cs b/Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.cs deleted file mode 100644 index 8124973..0000000 --- a/Apis/cv-matcher-data/Migrations/20260524140335_AddLanguageToCvMatchResult.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using CvMatcher.Data; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - /// - public partial class AddLanguageToCvMatchResult : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Language", - schema: MigrationConstants.SchemaName, - table: "Results", - type: "nvarchar(max)", - nullable: false, - defaultValue: "en"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Language", - schema: MigrationConstants.SchemaName, - table: "Results"); - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.Designer.cs b/Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.Designer.cs deleted file mode 100644 index 2b6bf0b..0000000 --- a/Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.Designer.cs +++ /dev/null @@ -1,130 +0,0 @@ -// -using System; -using CvMatcher.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - [DbContext(typeof(CvMatcherDbContext))] - [Migration("20260528110000_AddAiPrompts")] - partial class AddAiPrompts - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("cvMatcher") - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("CvMatcher.Data.Entities.AiPromptEntity", b => - { - b.Property("Key") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Language") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); - - b.Property("Description") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)") - .HasDefaultValue(""); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Key", "Language"); - - b.ToTable("AiPrompts", "cvMatcher"); - }); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatchResultEntity", b => - { - b.Property("Id") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("CvDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("JobDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("Language") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ResultJson") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Score") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CvDocumentId", "JobDocumentId") - .IsUnique(); - - b.ToTable("Results", "cvMatcher"); - }); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatcherChatCacheEntity", b => - { - b.Property("CacheKey") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Model") - .IsRequired() - .HasMaxLength(120) - .HasColumnType("nvarchar(120)"); - - b.Property("ResponseText") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Temperature") - .HasColumnType("decimal(4,2)"); - - b.HasKey("CacheKey"); - - b.ToTable("ChatCache", "cvMatcher"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.cs b/Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.cs deleted file mode 100644 index b135730..0000000 --- a/Apis/cv-matcher-data/Migrations/20260528110000_AddAiPrompts.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using CvMatcher.Data; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - /// - public partial class AddAiPrompts : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AiPrompts", - schema: MigrationConstants.SchemaName, - columns: table => new - { - Key = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), - Language = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: false), - Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false, defaultValue: ""), - UpdatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()") - }, - constraints: table => - { - table.PrimaryKey("PK_AiPrompts", x => new { x.Key, x.Language }); - }); - - migrationBuilder.InsertData( - schema: MigrationConstants.SchemaName, - table: "AiPrompts", - columns: ["Key", "Language", "Value", "Description"], - values: new object[] - { - "ai.cv-match.system-prompt", - "*", - "You are a strict CV-to-job matching engine. Return JSON only. Score realistically from 0 to 100.\nPenalize missing required skills. Do not invent experience. Use concise business language.\nRespond entirely in {{languageName}} — all text fields in the JSON must be in {{languageName}}.\nJSON shape: {\"score\":number,\"summary\":\"...\",\"strengths\":[\"...\"],\"gaps\":[\"...\"],\"recommendations\":[\"...\"],\"evidence\":[\"...\"]}", - "System prompt template for the CV-to-job LLM matching call. {{languageName}} is substituted at runtime." - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable(name: "AiPrompts", schema: MigrationConstants.SchemaName); - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.Designer.cs b/Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.Designer.cs deleted file mode 100644 index 6ed683b..0000000 --- a/Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.Designer.cs +++ /dev/null @@ -1,130 +0,0 @@ -// -using System; -using CvMatcher.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - [DbContext(typeof(CvMatcherDbContext))] - [Migration("20260529140000_UpdateCvMatchSystemPromptKeywords")] - partial class UpdateCvMatchSystemPromptKeywords - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("cvMatcher") - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("CvMatcher.Data.Entities.AiPromptEntity", b => - { - b.Property("Key") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Language") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); - - b.Property("Description") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)") - .HasDefaultValue(""); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Key", "Language"); - - b.ToTable("AiPrompts", "cvMatcher"); - }); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatchResultEntity", b => - { - b.Property("Id") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("CvDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("JobDocumentId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("Language") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ResultJson") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Score") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CvDocumentId", "JobDocumentId") - .IsUnique(); - - b.ToTable("Results", "cvMatcher"); - }); - - modelBuilder.Entity("CvMatcher.Data.Entities.CvMatcherChatCacheEntity", b => - { - b.Property("CacheKey") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Model") - .IsRequired() - .HasMaxLength(120) - .HasColumnType("nvarchar(120)"); - - b.Property("ResponseText") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Temperature") - .HasColumnType("decimal(4,2)"); - - b.HasKey("CacheKey"); - - b.ToTable("ChatCache", "cvMatcher"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.cs b/Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.cs deleted file mode 100644 index 5134906..0000000 --- a/Apis/cv-matcher-data/Migrations/20260529140000_UpdateCvMatchSystemPromptKeywords.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using CvMatcher.Data; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - /// - public partial class UpdateCvMatchSystemPromptKeywords : Migration - { - private const string OldPrompt = - "You are a strict CV-to-job matching engine. Return JSON only. Score realistically from 0 to 100.\n" + - "Penalize missing required skills. Do not invent experience. Use concise business language.\n" + - "Respond entirely in {{languageName}} — all text fields in the JSON must be in {{languageName}}.\n" + - "JSON shape: {\"score\":number,\"summary\":\"...\",\"strengths\":[\"...\"],\"gaps\":[\"...\"],\"recommendations\":[\"...\"],\"evidence\":[\"...\"]}"; - - private const string NewPrompt = - "You are a strict CV-to-job matching engine. Return JSON only. Score realistically from 0 to 100.\n" + - "Penalize missing required skills. Do not invent experience. Use concise business language.\n" + - "Respond entirely in {{languageName}} — all text fields in the JSON must be in {{languageName}}.\n" + - "Also extract 8 to 12 English job search keywords from the CV — job titles, technologies, skills, and domains.\n" + - "The keywords array must always be in English regardless of {{languageName}}. Exclude names, emails, phone numbers, and locations.\n" + - "JSON shape: {\"score\":number,\"summary\":\"...\",\"strengths\":[\"...\"],\"gaps\":[\"...\"],\"recommendations\":[\"...\"],\"evidence\":[\"...\"],\"keywords\":[\"term1\",\"term2\"]}"; - - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.UpdateData( - schema: MigrationConstants.SchemaName, - table: "AiPrompts", - keyColumns: ["Key", "Language"], - keyValues: new object[] { "ai.cv-match.system-prompt", "*" }, - column: "Value", - value: NewPrompt); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.UpdateData( - schema: MigrationConstants.SchemaName, - table: "AiPrompts", - keyColumns: ["Key", "Language"], - keyValues: new object[] { "ai.cv-match.system-prompt", "*" }, - column: "Value", - value: OldPrompt); - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.cs b/Apis/cv-matcher-data/Migrations/20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.cs deleted file mode 100644 index cf4c4ce..0000000 --- a/Apis/cv-matcher-data/Migrations/20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CvMatcher.Data.Migrations -{ - /// - public partial class UpdateResultsUniqueConstraintToIncludeLanguage : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_Results_CvDocumentId_JobDocumentId", - schema: "cvMatcher", - table: "Results"); - - migrationBuilder.AlterColumn( - name: "Language", - schema: "cvMatcher", - table: "Results", - type: "nvarchar(450)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.CreateIndex( - name: "IX_Results_CvDocumentId_JobDocumentId_Language", - schema: "cvMatcher", - table: "Results", - columns: new[] { "CvDocumentId", "JobDocumentId", "Language" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_Results_CvDocumentId_JobDocumentId_Language", - schema: "cvMatcher", - table: "Results"); - - migrationBuilder.AlterColumn( - name: "Language", - schema: "cvMatcher", - table: "Results", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(450)"); - - migrationBuilder.CreateIndex( - name: "IX_Results_CvDocumentId_JobDocumentId", - schema: "cvMatcher", - table: "Results", - columns: new[] { "CvDocumentId", "JobDocumentId" }, - unique: true); - } - } -} diff --git a/Apis/cv-matcher-data/Migrations/20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.Designer.cs b/Apis/cv-matcher-data/Migrations/20260601133028_InitialSchema.Designer.cs similarity index 96% rename from Apis/cv-matcher-data/Migrations/20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.Designer.cs rename to Apis/cv-matcher-data/Migrations/20260601133028_InitialSchema.Designer.cs index a50831d..af78445 100644 --- a/Apis/cv-matcher-data/Migrations/20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage.Designer.cs +++ b/Apis/cv-matcher-data/Migrations/20260601133028_InitialSchema.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace CvMatcher.Data.Migrations { [DbContext(typeof(CvMatcherDbContext))] - [Migration("20260601131043_UpdateResultsUniqueConstraintToIncludeLanguage")] - partial class UpdateResultsUniqueConstraintToIncludeLanguage + [Migration("20260601133028_InitialSchema")] + partial class InitialSchema { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/Apis/cv-matcher-data/Migrations/20260507140442_InitialCvMatcherSchema.cs b/Apis/cv-matcher-data/Migrations/20260601133028_InitialSchema.cs similarity index 62% rename from Apis/cv-matcher-data/Migrations/20260507140442_InitialCvMatcherSchema.cs rename to Apis/cv-matcher-data/Migrations/20260601133028_InitialSchema.cs index da2a029..8c0cb5f 100644 --- a/Apis/cv-matcher-data/Migrations/20260507140442_InitialCvMatcherSchema.cs +++ b/Apis/cv-matcher-data/Migrations/20260601133028_InitialSchema.cs @@ -1,23 +1,38 @@ -using System; +using System; using Microsoft.EntityFrameworkCore.Migrations; -using CvMatcher.Data; #nullable disable namespace CvMatcher.Data.Migrations { /// - public partial class InitialCvMatcherSchema : Migration + public partial class InitialSchema : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( - name: MigrationConstants.SchemaName); + name: "cvMatcher"); + + migrationBuilder.CreateTable( + name: "AiPrompts", + schema: "cvMatcher", + columns: table => new + { + Key = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Language = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: false), + Value = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false, defaultValue: ""), + UpdatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()") + }, + constraints: table => + { + table.PrimaryKey("PK_AiPrompts", x => new { x.Key, x.Language }); + }); migrationBuilder.CreateTable( name: "ChatCache", - schema: MigrationConstants.SchemaName, + schema: "cvMatcher", columns: table => new { CacheKey = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), @@ -33,12 +48,13 @@ namespace CvMatcher.Data.Migrations migrationBuilder.CreateTable( name: "Results", - schema: MigrationConstants.SchemaName, + schema: "cvMatcher", columns: table => new { Id = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), CvDocumentId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), JobDocumentId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Language = table.Column(type: "nvarchar(450)", nullable: false), ResultJson = table.Column(type: "nvarchar(max)", nullable: false), Score = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()") @@ -49,23 +65,27 @@ namespace CvMatcher.Data.Migrations }); migrationBuilder.CreateIndex( - name: "IX_Results_CvDocumentId_JobDocumentId", - schema: MigrationConstants.SchemaName, + name: "IX_Results_CvDocumentId_JobDocumentId_Language", + schema: "cvMatcher", table: "Results", - columns: new[] { "CvDocumentId", "JobDocumentId" }, + columns: new[] { "CvDocumentId", "JobDocumentId", "Language" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "AiPrompts", + schema: "cvMatcher"); + migrationBuilder.DropTable( name: "ChatCache", - schema: MigrationConstants.SchemaName); + schema: "cvMatcher"); migrationBuilder.DropTable( name: "Results", - schema: MigrationConstants.SchemaName); + schema: "cvMatcher"); } } } diff --git a/Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.Designer.cs b/Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.Designer.cs deleted file mode 100644 index b8667e8..0000000 --- a/Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.Designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Email.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Email.Data.Migrations -{ - [DbContext(typeof(EmailDbContext))] - [Migration("20260528100000_CreateEmailTemplates")] - partial class CreateEmailTemplates - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema(MigrationConstants.SchemaName) - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Email.Data.Entities.EmailTemplateEntity", b => - { - b.Property("Key") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Language") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); - - b.Property("Description") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)") - .HasDefaultValue(""); - - b.Property("OperatorCopy") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)") - .HasDefaultValue(""); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Key", "Language"); - - b.ToTable("EmailTemplates", MigrationConstants.SchemaName); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.cs b/Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.cs deleted file mode 100644 index 797adf5..0000000 --- a/Apis/email-data/Migrations/20260528100000_CreateEmailTemplates.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Email.Data; - -#nullable disable - -namespace Email.Data.Migrations -{ - /// - public partial class CreateEmailTemplates : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema(name: MigrationConstants.SchemaName); - - migrationBuilder.CreateTable( - name: "EmailTemplates", - schema: MigrationConstants.SchemaName, - columns: table => new - { - Key = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), - Language = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: false), - Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false, defaultValue: ""), - UpdatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()"), - OperatorCopy = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false, defaultValue: "") - }, - constraints: table => - { - table.PrimaryKey("PK_EmailTemplates", x => new { x.Key, x.Language }); - }); - } - - private static void Seed(MigrationBuilder m) - { - const string op = "contact@myai.ro"; - - void Row(string key, string lang, string value, string description = "", string operatorCopy = "") - => m.InsertData("EmailTemplates", - ["Key", "Language", "Value", "Description", "OperatorCopy"], - [key, lang, value, description, operatorCopy], - MigrationConstants.SchemaName); - - // ── HTML shell (no operator copy — these are layout fragments, not addressable emails) ── - Row("email.html-shell.start", "*", - "\n\n\n\n \n \n
\n \n \n \n \n
\n

myAi

\n
", - "Opening HTML shell fragment — wrapped around every HtmlBody before sending"); - - Row("email.html-shell.end", "*", - "
\n Automated message from myAi.\n
\n
\n\n", - "Closing HTML shell fragment — appended after every HtmlBody before sending"); - - // ── CV match result email ── - Row("email.match.subject", "en", - "MyAi.ro CV Match: {{score}}% - {{jobLabel}}", - "Subject for the CV match result email", - op); - - Row("email.match.subject", "ro", - "MyAi.ro Potrivire CV: {{score}}% - {{jobLabel}}", - "Subiect email rezultat potrivire CV", - op); - - Row("email.match.body", "en", - "

CV Match Report

" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "
CV ID{{cvDocumentId}}
Job{{jobLabel}}
URL{{jobUrl}}
Score{{score}}%
" + - "

Summary

" + - "

{{summary}}

" + - "

Strengths

{{strengths}}" + - "

Gaps

{{gaps}}" + - "

Recommendations

{{recommendations}}", - "Body for the CV match result email", - op); - - Row("email.match.body", "ro", - "

Raport Potrivire CV

" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "
ID Document CV{{cvDocumentId}}
Job{{jobLabel}}
URL{{jobUrl}}
Scor{{score}}%
" + - "

Rezumat

" + - "

{{summary}}

" + - "

Puncte forte

{{strengths}}" + - "

Lipsuri

{{gaps}}" + - "

Recomandări

{{recommendations}}", - "Corpul emailului pentru rezultatul potrivirii CV", - op); - - Row("email.match.job-search-footer", "en", - "
" + - "

" + - "Want to find matching jobs automatically? " + - "Start a job search →
" + - "Link valid for {{expiryDays}} days." + - "

" + - "
", - "Job search CTA appended to match result email", - op); - - Row("email.match.job-search-footer", "ro", - "
" + - "

" + - "Vrei să găsești joburi potrivite automat? " + - "Pornește o căutare de joburi →
" + - "Link valabil {{expiryDays}} zile." + - "

" + - "
", - "CTA cautare joburi adaugat la emailul de potrivire CV", - op); - - // ── Job search results email ── - Row("email.search-results.subject", "en", - "MyAi.ro: {{count}} jobs matching your CV", - "Subject for job search results email", - op); - - Row("email.search-results.subject", "ro", - "MyAi.ro: {{count}} joburi potrivite CV-ului tau", - "Subiect email rezultate cautare joburi", - op); - - Row("email.search-results.body", "en", - "

Job Search Results

" + - "

Found {{count}} matching job(s):

" + - "{{items}}", - "Body preamble for job search results email", - op); - - Row("email.search-results.body", "ro", - "

Rezultate Căutare Joburi

" + - "

Am găsit {{count}} job(uri) potrivite:

" + - "{{items}}", - "Corpul emailului de rezultate cautare joburi", - op); - - Row("email.search-results.empty", "en", - "
" + - "

No matching jobs found

" + - "

Your job search completed but no matching jobs were found. Try again later or adjust your CV.

" + - "
", - "No results message for job search results email", - op); - - Row("email.search-results.empty", "ro", - "
" + - "

Niciun job potrivit găsit

" + - "

Căutarea s-a finalizat dar nu au fost găsite joburi potrivite. Încearcă mai târziu sau ajustează CV-ul.

" + - "
", - "Mesaj fara rezultate pentru emailul de cautare joburi", - op); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable(name: "EmailTemplates", schema: MigrationConstants.SchemaName); - } - } -} diff --git a/Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.Designer.cs b/Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.Designer.cs deleted file mode 100644 index b93ffff..0000000 --- a/Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.Designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -using System; -using Email.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Email.Data.Migrations -{ - [DbContext(typeof(EmailDbContext))] - [Migration("20260528130652_SeedEmailTemplates")] - partial class SeedEmailTemplates - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema(MigrationConstants.SchemaName) - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Email.Data.Entities.EmailTemplateEntity", b => - { - b.Property("Key") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Language") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); - - b.Property("Description") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(500) - .HasColumnType("nvarchar(500)") - .HasDefaultValue(""); - - b.Property("OperatorCopy") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)") - .HasDefaultValue(""); - - b.Property("UpdatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("SYSUTCDATETIME()"); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Key", "Language"); - - b.ToTable("EmailTemplates", MigrationConstants.SchemaName); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.cs b/Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.cs deleted file mode 100644 index d1fd003..0000000 --- a/Apis/email-data/Migrations/20260528130652_SeedEmailTemplates.cs +++ /dev/null @@ -1,178 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using Email.Data; - -#nullable disable - -namespace Email.Data.Migrations -{ - /// - public partial class SeedEmailTemplates : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - Seed(migrationBuilder); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - // Delete all seeded templates (only those we know we added) - migrationBuilder.DeleteData( - table: "EmailTemplates", - keyColumns: new[] { "Key", "Language" }, - keyValues: new object[] { "email.html-shell.start", "*" }); - } - - private static void Seed(MigrationBuilder m) - { - const string op = "contact@myai.ro"; - const string schema = MigrationConstants.SchemaName; - - void Row(string key, string lang, string value, string description = "", string operatorCopy = "") - => m.InsertData("EmailTemplates", - ["Key", "Language", "Value", "Description", "OperatorCopy"], - [key, lang, value, description, operatorCopy], - schema); - - // ── HTML shell (no operator copy — these are layout fragments, not addressable emails) ── - Row("email.html-shell.start", "*", - "\n\n\n\n \n \n
\n \n \n \n \n
\n

myAi

\n
", - "Opening HTML shell fragment — wrapped around every HtmlBody before sending"); - - Row("email.html-shell.end", "*", - "
\n Automated message from myAi.\n
\n
\n\n", - "Closing HTML shell fragment — appended after every HtmlBody before sending"); - - // ── CV match result email ── - Row("email.match.subject", "en", - "MyAi.ro CV Match: {{score}}% - {{jobLabel}}", - "Subject for the CV match result email", - op); - - Row("email.match.subject", "ro", - "MyAi.ro Potrivire CV: {{score}}% - {{jobLabel}}", - "Subiect email rezultat potrivire CV", - op); - - Row("email.match.body", "en", - "

CV Match Report

" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "
CV ID{{cvDocumentId}}
Job{{jobLabel}}
URL{{jobUrl}}
Score{{score}}%
" + - "

Summary

" + - "

{{summary}}

" + - "

Strengths

{{strengths}}" + - "

Gaps

{{gaps}}" + - "

Recommendations

{{recommendations}}", - "Body for the CV match result email", - op); - - Row("email.match.body", "ro", - "

Raport Potrivire CV

" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "
ID Document CV{{cvDocumentId}}
Job{{jobLabel}}
URL{{jobUrl}}
Scor{{score}}%
" + - "

Rezumat

" + - "

{{summary}}

" + - "

Puncte forte

{{strengths}}" + - "

Lipsuri

{{gaps}}" + - "

Recomandări

{{recommendations}}", - "Corpul emailului pentru rezultatul potrivirii CV", - op); - - Row("email.match.job-search-footer", "en", - "
" + - "

" + - "Want to find matching jobs automatically? " + - "Start a job search →
" + - "Link valid for {{expiryDays}} days." + - "

" + - "
", - "Job search CTA appended to match result email", - op); - - Row("email.match.job-search-footer", "ro", - "
" + - "

" + - "Vrei să găsești joburi potrivite automat? " + - "Pornește o căutare de joburi →
" + - "Link valabil {{expiryDays}} zile." + - "

" + - "
", - "CTA cautare joburi adaugat la emailul de potrivire CV", - op); - - // ── Job search results email ── - Row("email.search-results.subject", "en", - "MyAi.ro: {{count}} jobs matching your CV", - "Subject for job search results email", - op); - - Row("email.search-results.subject", "ro", - "MyAi.ro: {{count}} joburi potrivite CV-ului tau", - "Subiect email rezultate cautare joburi", - op); - - Row("email.search-results.body", "en", - "

Job Search Results

" + - "

Found {{count}} matching job(s):

" + - "{{items}}", - "Body preamble for job search results email", - op); - - Row("email.search-results.body", "ro", - "

Rezultate Căutare Joburi

" + - "

Am găsit {{count}} job(uri) potrivite:

" + - "{{items}}", - "Corpul emailului de rezultate cautare joburi", - op); - - Row("email.search-results.empty", "en", - "
" + - "

No matching jobs found

" + - "

Your job search completed but no matching jobs were found. Try again later or adjust your CV.

" + - "
", - "No results message for job search results email", - op); - - Row("email.search-results.empty", "ro", - "
" + - "

Niciun job potrivit găsit

" + - "

Căutarea s-a finalizat dar nu au fost găsite joburi potrivite. Încearcă mai târziu sau ajustează CV-ul.

" + - "
", - "Mesaj fara rezultate pentru emailul de cautare joburi", - op); - } - } -} diff --git a/Apis/email-data/Migrations/20260601132154_RenameEmailTemplatesToTemplates.cs b/Apis/email-data/Migrations/20260601132154_RenameEmailTemplatesToTemplates.cs deleted file mode 100644 index a025685..0000000 --- a/Apis/email-data/Migrations/20260601132154_RenameEmailTemplatesToTemplates.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Email.Data.Migrations -{ - /// - public partial class RenameEmailTemplatesToTemplates : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameTable( - name: "EmailTemplates", - schema: MigrationConstants.SchemaName, - newName: "Templates"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameTable( - name: "Templates", - schema: MigrationConstants.SchemaName, - newName: "EmailTemplates"); - } - } -} diff --git a/Apis/email-data/Migrations/20260601132154_RenameEmailTemplatesToTemplates.Designer.cs b/Apis/email-data/Migrations/20260601133043_InitialSchema.Designer.cs similarity index 95% rename from Apis/email-data/Migrations/20260601132154_RenameEmailTemplatesToTemplates.Designer.cs rename to Apis/email-data/Migrations/20260601133043_InitialSchema.Designer.cs index ac1be70..540cb27 100644 --- a/Apis/email-data/Migrations/20260601132154_RenameEmailTemplatesToTemplates.Designer.cs +++ b/Apis/email-data/Migrations/20260601133043_InitialSchema.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Email.Data.Migrations { [DbContext(typeof(EmailDbContext))] - [Migration("20260601132154_RenameEmailTemplatesToTemplates")] - partial class RenameEmailTemplatesToTemplates + [Migration("20260601133043_InitialSchema")] + partial class InitialSchema { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/Apis/email-data/Migrations/20260601133043_InitialSchema.cs b/Apis/email-data/Migrations/20260601133043_InitialSchema.cs new file mode 100644 index 0000000..91c2012 --- /dev/null +++ b/Apis/email-data/Migrations/20260601133043_InitialSchema.cs @@ -0,0 +1,43 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Email.Data.Migrations +{ + /// + public partial class InitialSchema : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "email"); + + migrationBuilder.CreateTable( + name: "Templates", + schema: "email", + columns: table => new + { + Key = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Language = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: false), + Value = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false, defaultValue: ""), + UpdatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "SYSUTCDATETIME()"), + OperatorCopy = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false, defaultValue: "") + }, + constraints: table => + { + table.PrimaryKey("PK_Templates", x => new { x.Key, x.Language }); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Templates", + schema: "email"); + } + } +} diff --git a/Apis/email-data/Migrations/EmailDbContextModelSnapshot.cs b/Apis/email-data/Migrations/EmailDbContextModelSnapshot.cs index db53a2d..6556cfb 100644 --- a/Apis/email-data/Migrations/EmailDbContextModelSnapshot.cs +++ b/Apis/email-data/Migrations/EmailDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ namespace Email.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasDefaultSchema(MigrationConstants.SchemaName) + .HasDefaultSchema("email") .HasAnnotation("ProductVersion", "10.0.7") .HasAnnotation("Relational:MaxIdentifierLength", 128); @@ -58,7 +58,7 @@ namespace Email.Data.Migrations b.HasKey("Key", "Language"); - b.ToTable("Templates", MigrationConstants.SchemaName); + b.ToTable("Templates", "email"); }); #pragma warning restore 612, 618 }