refactor(db): migrate job workspace notes

Move interview preparation and AI workspace output persistence into an additive provider-aware migration. Preserve reviewed results, uniqueness, and application cascade semantics.
This commit is contained in:
cesnimda
2026-08-30 17:22:04 +02:00
parent 9922426aa5
commit 778b365f9e
9 changed files with 186 additions and 93 deletions
+7 -3
View File
@@ -66,9 +66,9 @@ already-correct database. Two consequences worth knowing:
Created by EF migrations, never by the reconciler:
`AccountDeletionFiles`, `AccountDeletionRequests`, `AiUsageRecords`, `Attachments`, `Companies`,
`AccountDeletionFiles`, `AccountDeletionRequests`, `AiUsageRecords`, `AiWorkspaceNotes`, `Attachments`, `Companies`,
`Correspondences`, `CvExtractionRuns`, `CvUploadArtifacts`, `EmailDrafts`, `EmailSendAttempts`, `GmailConnections`,
`GmailReviewDecisions`, `ImapConnections`, `JobApplications`, `JobEvents`, `Jobs`,
`GmailReviewDecisions`, `ImapConnections`, `InterviewPrepNotes`, `JobApplications`, `JobEvents`, `Jobs`,
`MicrosoftGraphConnections`, `RuleSettings`, `SystemEmailSettings`, `TailoredCvDrafts`,
`TrustedDevices`, `TwoFactorRecoveryCodes`, `UserNotifications`, `UserOperations`, `UserRuleSettings`,
and `UserSessions`.
@@ -101,6 +101,10 @@ The CV import persistence group (`CvUploadArtifacts` and `CvExtractionRuns`) mov
content is retained during adoption while the one-to-one job-application relationship remains
`ON DELETE CASCADE`.
The persisted job-workspace note group (`InterviewPrepNotes` and `AiWorkspaceNotes`) moved in
`20260830127000_AdoptJobWorkspaceNotesSchema`. Both caches retain their unique owner/job keys and
remain application-owned through `ON DELETE CASCADE`.
The reconciler may **repair** these (add a missing column, add an index, fix a non-`AUTO_INCREMENT`
primary key) and may seed the default `RuleSettings` row — but it must never `CREATE TABLE` them.
It used to create `RuleSettings`, which is precisely why a clean install failed with
@@ -112,7 +116,7 @@ Created by `StartupInitializationExtensions`, with a **no-op migration** holding
`CareerProfiles`, `CareerProfileVersions`, the six CareerProfile children (`CareerExperiences`,
`CareerEducations`, `CareerSkills`, `CareerProjects`, `CareerCertifications`, `CareerLanguages`),
`InterviewPrepNotes`, `AiWorkspaceNotes`, `CvVariants`, `CvVariantVersions`, `AiInteractions`,
`CvVariants`, `CvVariantVersions`, `AiInteractions`,
`ApplicationChecklistItems`, `CoverLetterVersions`, and `InterviewPrepItems`.
The seven ASP.NET Identity tables are also currently reconciler-owned, despite older wording that