refactor(db): migrate AI interaction history

Move append-only AI results into an additive provider-aware migration. Preserve generated content, usage counters, indexes, and application cascade semantics.
This commit is contained in:
cesnimda
2026-08-30 18:48:42 +02:00
parent bc28893b6f
commit ae57d1afde
9 changed files with 148 additions and 54 deletions
@@ -13,6 +13,7 @@ internal static class StartupSchemaOwnership
"AccountDeletionRequests",
"AiUsageRecords",
"AiWorkspaceNotes",
"AiInteractions",
"Attachments",
"Companies",
"Correspondences",
@@ -43,7 +44,6 @@ internal static class StartupSchemaOwnership
internal static readonly IReadOnlySet<string> ReconcilerOwnedTables = new HashSet<string>(StringComparer.Ordinal)
{
"AiInteractions",
"ApplicationChecklistItems",
"AspNetRoleClaims",
"AspNetRoles",
@@ -67,5 +67,5 @@ internal static class StartupSchemaOwnership
// Historical migrations contain guarded compatibility bootstraps for these tables so direct
// EF tooling can traverse the chain. Their current creation owner remains the reconciler.
internal static readonly IReadOnlySet<string> MigrationCompatibilityBootstrapTables =
new HashSet<string>(StringComparer.Ordinal) { "AiInteractions", "AspNetUsers" };
new HashSet<string>(StringComparer.Ordinal) { "AspNetUsers" };
}