refactor(db): migrate auth support tables
Move recovery codes, trusted devices, and revocable sessions into an additive provider-aware migration. Preserve existing security records and retain guarded MariaDB repairs for historical schemas.
This commit is contained in:
@@ -67,8 +67,10 @@ already-correct database. Two consequences worth knowing:
|
||||
Created by EF migrations, never by the reconciler:
|
||||
|
||||
`AccountDeletionFiles`, `AccountDeletionRequests`, `AiUsageRecords`, `Attachments`, `Companies`,
|
||||
`Correspondences`, `EmailDrafts`, `EmailSendAttempts`, `GmailReviewDecisions`, `JobApplications`, `JobEvents`, `Jobs`,
|
||||
`RuleSettings`, `SystemEmailSettings`, `UserNotifications`, `UserOperations`, and `UserRuleSettings`.
|
||||
`Correspondences`, `EmailDrafts`, `EmailSendAttempts`, `GmailReviewDecisions`, `JobApplications`,
|
||||
`JobEvents`, `Jobs`, `RuleSettings`, `SystemEmailSettings`, `TrustedDevices`,
|
||||
`TwoFactorRecoveryCodes`, `UserNotifications`, `UserOperations`, `UserRuleSettings`, and
|
||||
`UserSessions`.
|
||||
|
||||
`SystemEmailSettings` is the first completed ownership transfer: migration
|
||||
`20260830120000_AdoptSystemEmailSettingsSchema` creates it for both supported providers and preserves
|
||||
@@ -80,6 +82,11 @@ preserved across adoption, downgrade and retry, and startup no longer creates it
|
||||
`GmailReviewDecisions` moved in `20260830122000_AdoptGmailReviewDecisionsSchema`. This also supplies
|
||||
the table on MariaDB, where the old reconciler had no creation path.
|
||||
|
||||
The authentication support group (`TwoFactorRecoveryCodes`, `TrustedDevices`, and `UserSessions`)
|
||||
moved in `20260830123000_AdoptAuthenticationSupportSchema`. These tables deliberately have no
|
||||
database foreign key to `AspNetUsers` because they are queried during authentication before a
|
||||
current-user scope exists.
|
||||
|
||||
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
|
||||
@@ -94,8 +101,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`,
|
||||
`ApplicationChecklistItems`, `CoverLetterVersions`, `InterviewPrepItems`, `TwoFactorRecoveryCodes`,
|
||||
`TrustedDevices`, `UserSessions`.
|
||||
`ApplicationChecklistItems`, `CoverLetterVersions`, and `InterviewPrepItems`.
|
||||
|
||||
The seven ASP.NET Identity tables are also currently reconciler-owned, despite older wording that
|
||||
called them migration-owned: `AspNetRoles`, `AspNetUsers`, `AspNetRoleClaims`, `AspNetUserClaims`,
|
||||
|
||||
Reference in New Issue
Block a user