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:
@@ -111,6 +111,8 @@ public sealed class MigrationChainTests
|
||||
Assert.Contains("CREATE TABLE IF NOT EXISTS `CvUploadArtifacts`", script, StringComparison.Ordinal);
|
||||
Assert.Contains("CREATE TABLE IF NOT EXISTS `CvExtractionRuns`", script, StringComparison.Ordinal);
|
||||
Assert.Contains("CREATE TABLE IF NOT EXISTS `TailoredCvDrafts`", script, StringComparison.Ordinal);
|
||||
Assert.Contains("CREATE TABLE IF NOT EXISTS `InterviewPrepNotes`", script, StringComparison.Ordinal);
|
||||
Assert.Contains("CREATE TABLE IF NOT EXISTS `AiWorkspaceNotes`", script, StringComparison.Ordinal);
|
||||
Assert.Contains("`UiLanguage` varchar(16)", script, StringComparison.Ordinal);
|
||||
Assert.All(
|
||||
Regex.Matches(script, "CONSTRAINT `([^`]+)`").Select(match => match.Groups[1].Value),
|
||||
@@ -507,6 +509,76 @@ public sealed class MigrationChainTests
|
||||
Assert.Empty(await db.Database.GetPendingMigrationsAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Job_workspace_note_adoption_preserves_outputs_and_cascade_relationships()
|
||||
{
|
||||
await using var connection = new SqliteConnection("Data Source=:memory:");
|
||||
await connection.OpenAsync();
|
||||
await using var db = Context(connection);
|
||||
var migrator = db.GetService<IMigrator>();
|
||||
await migrator.MigrateAsync("20260830126000_AdoptTailoredCvDraftSchema");
|
||||
await ExecuteAsync(connection, """
|
||||
INSERT INTO Companies (Name) VALUES ('Fixture company');
|
||||
INSERT INTO JobApplications
|
||||
(CompanyId, JobTitle, DateApplied, SavedAt, Status, ResponseReceived, OwnerUserId,
|
||||
HasResume, HasCoverLetter, HasPortfolio, HasOtherAttachment, IsDeleted)
|
||||
VALUES
|
||||
(1, 'Fixture role', '2026-08-01T09:00:00', '2026-07-20T09:00:00',
|
||||
'Applied', 0, 'owner-fixture', 0, 0, 0, 0, 0);
|
||||
|
||||
CREATE TABLE "InterviewPrepNotes" (
|
||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_InterviewPrepNotes" PRIMARY KEY AUTOINCREMENT,
|
||||
"OwnerUserId" TEXT NOT NULL, "JobApplicationId" INTEGER NOT NULL,
|
||||
"AttachmentContextSignature" TEXT NOT NULL, "Summary" TEXT NOT NULL,
|
||||
"TalkingPointsJson" TEXT NOT NULL, "LikelyQuestionsJson" TEXT NOT NULL,
|
||||
"WeakSpotsJson" TEXT NOT NULL, "GeneratedAtUtc" TEXT NOT NULL,
|
||||
CONSTRAINT "FK_InterviewPrepNotes_JobApplications_JobApplicationId"
|
||||
FOREIGN KEY ("JobApplicationId") REFERENCES "JobApplications" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
INSERT INTO "InterviewPrepNotes"
|
||||
("OwnerUserId", "JobApplicationId", "AttachmentContextSignature", "Summary",
|
||||
"TalkingPointsJson", "LikelyQuestionsJson", "WeakSpotsJson", "GeneratedAtUtc")
|
||||
VALUES ('owner-fixture', 1, 'attachments-v1', 'Preserve interview summary',
|
||||
'["point"]', '["question"]', '["gap"]', '2026-08-30T09:00:00+00:00');
|
||||
|
||||
CREATE TABLE "AiWorkspaceNotes" (
|
||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_AiWorkspaceNotes" PRIMARY KEY AUTOINCREMENT,
|
||||
"OwnerUserId" TEXT NOT NULL, "JobApplicationId" INTEGER NOT NULL,
|
||||
"NoteType" TEXT NOT NULL, "AttachmentContextSignature" TEXT NOT NULL,
|
||||
"ResultJson" TEXT NOT NULL, "GeneratedAtUtc" TEXT NOT NULL,
|
||||
CONSTRAINT "FK_AiWorkspaceNotes_JobApplications_JobApplicationId"
|
||||
FOREIGN KEY ("JobApplicationId") REFERENCES "JobApplications" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
INSERT INTO "AiWorkspaceNotes"
|
||||
("OwnerUserId", "JobApplicationId", "NoteType", "AttachmentContextSignature",
|
||||
"ResultJson", "GeneratedAtUtc")
|
||||
VALUES ('owner-fixture', 1, 'candidate-fit', 'attachments-v1',
|
||||
'{"strength":"preserve me"}', '2026-08-30T09:00:00+00:00');
|
||||
""");
|
||||
|
||||
await migrator.MigrateAsync();
|
||||
Assert.Equal("Preserve interview summary", await ScalarAsync<string>(connection,
|
||||
"SELECT Summary FROM InterviewPrepNotes WHERE JobApplicationId = 1;"));
|
||||
Assert.Equal("{\"strength\":\"preserve me\"}", await ScalarAsync<string>(connection,
|
||||
"SELECT ResultJson FROM AiWorkspaceNotes WHERE JobApplicationId = 1;"));
|
||||
|
||||
await migrator.MigrateAsync("20260830126000_AdoptTailoredCvDraftSchema");
|
||||
Assert.Equal("attachments-v1", await ScalarAsync<string>(connection,
|
||||
"SELECT AttachmentContextSignature FROM InterviewPrepNotes WHERE JobApplicationId = 1;"));
|
||||
await migrator.MigrateAsync();
|
||||
Assert.Equal(2L, await ScalarAsync<long>(connection, """
|
||||
SELECT COUNT(*) FROM sqlite_master
|
||||
WHERE type = 'index' AND name IN (
|
||||
'IX_InterviewPrepNotes_OwnerUserId_JobApplicationId',
|
||||
'IX_AiWorkspaceNotes_OwnerUserId_JobApplicationId_NoteType');
|
||||
"""));
|
||||
|
||||
await ExecuteAsync(connection, "DELETE FROM JobApplications WHERE Id = 1;");
|
||||
Assert.Equal(0L, await ScalarAsync<long>(connection, "SELECT COUNT(*) FROM InterviewPrepNotes;"));
|
||||
Assert.Equal(0L, await ScalarAsync<long>(connection, "SELECT COUNT(*) FROM AiWorkspaceNotes;"));
|
||||
Assert.Empty(await db.Database.GetPendingMigrationsAsync());
|
||||
}
|
||||
|
||||
private static JobTrackerContext Context(SqliteConnection connection)
|
||||
{
|
||||
var currentUser = new Mock<ICurrentUserService>();
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using JobTrackerApi.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace JobTrackerApi.Migrations;
|
||||
|
||||
/// <summary>
|
||||
/// Moves persisted job-workspace AI outputs into migration ownership without replacing existing
|
||||
/// interview preparation, candidate-fit, or focus-plan content.
|
||||
/// </summary>
|
||||
[DbContext(typeof(JobTrackerContext))]
|
||||
[Migration("20260830127000_AdoptJobWorkspaceNotesSchema")]
|
||||
public sealed class AdoptJobWorkspaceNotesSchema : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (ActiveProvider.Contains("MySql", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
migrationBuilder.Sql("""
|
||||
CREATE TABLE IF NOT EXISTS `InterviewPrepNotes` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`OwnerUserId` varchar(255) NOT NULL,
|
||||
`JobApplicationId` int NOT NULL,
|
||||
`AttachmentContextSignature` longtext NOT NULL,
|
||||
`Summary` longtext NOT NULL,
|
||||
`TalkingPointsJson` longtext NOT NULL,
|
||||
`LikelyQuestionsJson` longtext NOT NULL,
|
||||
`WeakSpotsJson` longtext NOT NULL,
|
||||
`GeneratedAtUtc` datetime(6) NOT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_InterviewPrepNotes_JobApplications_JobApplicationId`
|
||||
FOREIGN KEY (`JobApplicationId`) REFERENCES `JobApplications` (`Id`) ON DELETE CASCADE
|
||||
) CHARACTER SET=utf8mb4;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS `IX_InterviewPrepNotes_OwnerUserId_JobApplicationId`
|
||||
ON `InterviewPrepNotes` (`OwnerUserId`(191), `JobApplicationId`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `AiWorkspaceNotes` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`OwnerUserId` varchar(255) NOT NULL,
|
||||
`JobApplicationId` int NOT NULL,
|
||||
`NoteType` varchar(50) NOT NULL,
|
||||
`AttachmentContextSignature` longtext NOT NULL,
|
||||
`ResultJson` longtext NOT NULL,
|
||||
`GeneratedAtUtc` datetime(6) NOT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_AiWorkspaceNotes_JobApplications_JobApplicationId`
|
||||
FOREIGN KEY (`JobApplicationId`) REFERENCES `JobApplications` (`Id`) ON DELETE CASCADE
|
||||
) CHARACTER SET=utf8mb4;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS `IX_AiWorkspaceNotes_OwnerUserId_JobApplicationId_NoteType`
|
||||
ON `AiWorkspaceNotes` (`OwnerUserId`(191), `JobApplicationId`, `NoteType`);
|
||||
""");
|
||||
return;
|
||||
}
|
||||
|
||||
migrationBuilder.Sql("""
|
||||
CREATE TABLE IF NOT EXISTS "InterviewPrepNotes" (
|
||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_InterviewPrepNotes" PRIMARY KEY AUTOINCREMENT,
|
||||
"OwnerUserId" TEXT NOT NULL,
|
||||
"JobApplicationId" INTEGER NOT NULL,
|
||||
"AttachmentContextSignature" TEXT NOT NULL,
|
||||
"Summary" TEXT NOT NULL,
|
||||
"TalkingPointsJson" TEXT NOT NULL,
|
||||
"LikelyQuestionsJson" TEXT NOT NULL,
|
||||
"WeakSpotsJson" TEXT NOT NULL,
|
||||
"GeneratedAtUtc" TEXT NOT NULL,
|
||||
CONSTRAINT "FK_InterviewPrepNotes_JobApplications_JobApplicationId"
|
||||
FOREIGN KEY ("JobApplicationId") REFERENCES "JobApplications" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "IX_InterviewPrepNotes_OwnerUserId_JobApplicationId"
|
||||
ON "InterviewPrepNotes" ("OwnerUserId", "JobApplicationId");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "AiWorkspaceNotes" (
|
||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_AiWorkspaceNotes" PRIMARY KEY AUTOINCREMENT,
|
||||
"OwnerUserId" TEXT NOT NULL,
|
||||
"JobApplicationId" INTEGER NOT NULL,
|
||||
"NoteType" TEXT NOT NULL,
|
||||
"AttachmentContextSignature" TEXT NOT NULL,
|
||||
"ResultJson" TEXT NOT NULL,
|
||||
"GeneratedAtUtc" TEXT NOT NULL,
|
||||
CONSTRAINT "FK_AiWorkspaceNotes_JobApplications_JobApplicationId"
|
||||
FOREIGN KEY ("JobApplicationId") REFERENCES "JobApplications" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "IX_AiWorkspaceNotes_OwnerUserId_JobApplicationId_NoteType"
|
||||
ON "AiWorkspaceNotes" ("OwnerUserId", "JobApplicationId", "NoteType");
|
||||
""");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// Preserve generated and user-reviewed job-workspace notes from older installations.
|
||||
}
|
||||
}
|
||||
@@ -705,50 +705,6 @@ public static class StartupInitializationExtensions
|
||||
Exec(c, """CREATE INDEX IF NOT EXISTS "IX_CareerLanguages_OwnerUserId_CareerProfileId_SortOrder" ON "CareerLanguages" ("OwnerUserId", "CareerProfileId", "SortOrder");""");
|
||||
}
|
||||
|
||||
// Interview prep persistence (career-workspace-implementation-roadmap.md Phase F5):
|
||||
// stop re-running the AI call on every tab open by persisting the last generated
|
||||
// note per job, keyed by the attachment selection it was generated from.
|
||||
static void EnsureInterviewPrepNotesTable(DbConnection c)
|
||||
{
|
||||
Exec(c, """
|
||||
CREATE TABLE IF NOT EXISTS "InterviewPrepNotes" (
|
||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_InterviewPrepNotes" PRIMARY KEY AUTOINCREMENT,
|
||||
"OwnerUserId" TEXT NOT NULL,
|
||||
"JobApplicationId" INTEGER NOT NULL,
|
||||
"AttachmentContextSignature" TEXT NOT NULL,
|
||||
"Summary" TEXT NOT NULL,
|
||||
"TalkingPointsJson" TEXT NOT NULL,
|
||||
"LikelyQuestionsJson" TEXT NOT NULL,
|
||||
"WeakSpotsJson" TEXT NOT NULL,
|
||||
"GeneratedAtUtc" TEXT NOT NULL,
|
||||
CONSTRAINT "FK_InterviewPrepNotes_JobApplications_JobApplicationId" FOREIGN KEY ("JobApplicationId") REFERENCES "JobApplications" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
""");
|
||||
|
||||
Exec(c, """CREATE UNIQUE INDEX IF NOT EXISTS "IX_InterviewPrepNotes_OwnerUserId_JobApplicationId" ON "InterviewPrepNotes" ("OwnerUserId", "JobApplicationId");""");
|
||||
}
|
||||
|
||||
// Generic AI workspace note persistence (candidate fit, focus plan) -- same
|
||||
// rationale as EnsureInterviewPrepNotesTable, generalized for DTOs too irregular
|
||||
// for per-field columns.
|
||||
static void EnsureAiWorkspaceNotesTable(DbConnection c)
|
||||
{
|
||||
Exec(c, """
|
||||
CREATE TABLE IF NOT EXISTS "AiWorkspaceNotes" (
|
||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_AiWorkspaceNotes" PRIMARY KEY AUTOINCREMENT,
|
||||
"OwnerUserId" TEXT NOT NULL,
|
||||
"JobApplicationId" INTEGER NOT NULL,
|
||||
"NoteType" TEXT NOT NULL,
|
||||
"AttachmentContextSignature" TEXT NOT NULL,
|
||||
"ResultJson" TEXT NOT NULL,
|
||||
"GeneratedAtUtc" TEXT NOT NULL,
|
||||
CONSTRAINT "FK_AiWorkspaceNotes_JobApplications_JobApplicationId" FOREIGN KEY ("JobApplicationId") REFERENCES "JobApplications" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
""");
|
||||
|
||||
Exec(c, """CREATE UNIQUE INDEX IF NOT EXISTS "IX_AiWorkspaceNotes_OwnerUserId_JobApplicationId_NoteType" ON "AiWorkspaceNotes" ("OwnerUserId", "JobApplicationId", "NoteType");""");
|
||||
}
|
||||
|
||||
// Phase 4 CV Builder: a variant is a lens over the master profile; versions are its
|
||||
// autosave history. Reconciler-owned (not migration-owned) so the schema is MySQL-safe
|
||||
// on prod -- see the AddCvVariants migration note. docs/architecture/cv-builder.md.
|
||||
@@ -885,8 +841,6 @@ public static class StartupInitializationExtensions
|
||||
|
||||
ReconcileGmailConnectionColumns(conn);
|
||||
EnsureCareerProfileTables(conn);
|
||||
EnsureInterviewPrepNotesTable(conn);
|
||||
EnsureAiWorkspaceNotesTable(conn);
|
||||
EnsureCvBuilderTables(conn);
|
||||
EnsureAiInteractionsTable(conn);
|
||||
EnsureApplicationChecklistTable(conn);
|
||||
@@ -1273,44 +1227,6 @@ public static class StartupInitializationExtensions
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// Interview prep persistence (career-workspace-implementation-roadmap.md Phase F5).
|
||||
if (!HasMySqlTable(conn, "InterviewPrepNotes") && HasMySqlTable(conn, "JobApplications"))
|
||||
{
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"CREATE TABLE IF NOT EXISTS `InterviewPrepNotes` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`OwnerUserId` varchar(255) NOT NULL,
|
||||
`JobApplicationId` int NOT NULL,
|
||||
`AttachmentContextSignature` longtext NOT NULL,
|
||||
`Summary` longtext NOT NULL,
|
||||
`TalkingPointsJson` longtext NOT NULL,
|
||||
`LikelyQuestionsJson` longtext NOT NULL,
|
||||
`WeakSpotsJson` longtext NOT NULL,
|
||||
`GeneratedAtUtc` datetime(6) NOT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_InterviewPrepNotes_JobApplications_JobApplicationId` FOREIGN KEY (`JobApplicationId`) REFERENCES `JobApplications` (`Id`) ON DELETE CASCADE
|
||||
);";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// Generic AI workspace note persistence (candidate fit, focus plan).
|
||||
if (!HasMySqlTable(conn, "AiWorkspaceNotes") && HasMySqlTable(conn, "JobApplications"))
|
||||
{
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"CREATE TABLE IF NOT EXISTS `AiWorkspaceNotes` (
|
||||
`Id` int NOT NULL AUTO_INCREMENT,
|
||||
`OwnerUserId` varchar(255) NOT NULL,
|
||||
`JobApplicationId` int NOT NULL,
|
||||
`NoteType` varchar(50) NOT NULL,
|
||||
`AttachmentContextSignature` longtext NOT NULL,
|
||||
`ResultJson` longtext NOT NULL,
|
||||
`GeneratedAtUtc` datetime(6) NOT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_AiWorkspaceNotes_JobApplications_JobApplicationId` FOREIGN KEY (`JobApplicationId`) REFERENCES `JobApplications` (`Id`) ON DELETE CASCADE
|
||||
);";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// Phase 4 CV Builder + Phase 5 AI Workspace. Reconciler-owned rather than
|
||||
// migration-owned: those migrations were scaffolded against SQLite, so on MariaDB
|
||||
// they emit TEXT datetimes and a PK with no AUTO_INCREMENT, and the composite
|
||||
|
||||
@@ -12,6 +12,7 @@ internal static class StartupSchemaOwnership
|
||||
"AccountDeletionFiles",
|
||||
"AccountDeletionRequests",
|
||||
"AiUsageRecords",
|
||||
"AiWorkspaceNotes",
|
||||
"Attachments",
|
||||
"Companies",
|
||||
"Correspondences",
|
||||
@@ -22,6 +23,7 @@ internal static class StartupSchemaOwnership
|
||||
"GmailConnections",
|
||||
"GmailReviewDecisions",
|
||||
"ImapConnections",
|
||||
"InterviewPrepNotes",
|
||||
"JobApplications",
|
||||
"JobEvents",
|
||||
"Jobs",
|
||||
@@ -40,7 +42,6 @@ internal static class StartupSchemaOwnership
|
||||
internal static readonly IReadOnlySet<string> ReconcilerOwnedTables = new HashSet<string>(StringComparer.Ordinal)
|
||||
{
|
||||
"AiInteractions",
|
||||
"AiWorkspaceNotes",
|
||||
"ApplicationChecklistItems",
|
||||
"AspNetRoleClaims",
|
||||
"AspNetRoles",
|
||||
@@ -61,7 +62,6 @@ internal static class StartupSchemaOwnership
|
||||
"CvVariants",
|
||||
"CvVariantVersions",
|
||||
"InterviewPrepItems",
|
||||
"InterviewPrepNotes",
|
||||
};
|
||||
|
||||
// Historical migrations contain guarded compatibility bootstraps for these tables so direct
|
||||
|
||||
@@ -558,7 +558,7 @@ SEC-008 implements the same durable state machine with `<final>.uploading` and `
|
||||
|
||||
### P3-1 — Reduce dual schema ownership incrementally
|
||||
|
||||
**Status (2026-08-30): in progress.** All 49 model tables now have an executable, disjoint creation-owner classification. Twelve formerly reconciler-created tables—including authentication support, email-provider connections, CV extraction persistence, and tailored CV drafts—have moved through additive provider-aware migrations with legacy-row preservation, downgrade/retry safety, startup-DDL removal, fresh SQLite runtime proof and generated MariaDB SQL. The Gmail decision migration also closes its missing MariaDB creation path. Twenty-three startup-created tables remain; see `docs/verification/jt-019-schema-ownership.md` and V-194–V-200.
|
||||
**Status (2026-08-30): in progress.** All 49 model tables now have an executable, disjoint creation-owner classification. Fourteen formerly reconciler-created tables—including authentication support, email-provider connections, CV extraction persistence, tailored CV drafts, and persisted job-workspace AI notes—have moved through additive provider-aware migrations with legacy-row preservation, downgrade/retry safety, startup-DDL removal, fresh SQLite runtime proof and generated MariaDB SQL. The Gmail decision migration also closes its missing MariaDB creation path. Twenty-one startup-created tables remain; see `docs/verification/jt-019-schema-ownership.md` and V-194–V-201.
|
||||
|
||||
- **Findings/scope:** JT-019; inventory reconciler operations and move stable schema ownership to EF migrations in small steps.
|
||||
- **Dependencies:** provider upgrade fixtures and P2-2 restore safety.
|
||||
|
||||
@@ -232,3 +232,4 @@ Output was reduced to filenames and commit counts. The token artifact appears un
|
||||
| V-198 | Ownership/migration chain; populated adoption/downgrade/retry; encrypted-value and index assertions; MariaDB script; full backend | Repository root / disposable local SQLite | Move Gmail, Microsoft Graph, and IMAP connection records to migration ownership without losing credentials or sync state | PASS — focused ownership/migration 10/10; representative encrypted values survive adoption, downgrade and re-upgrade; all five expected indexes exist; generated MariaDB SQL contains all three provider-safe definitions; both startup-create paths are removed; full backend 726/726 | MariaDB SQL generated only; no provider account or production migration. Gmail column repair and guarded MariaDB index/auto-increment repairs remain temporarily. Twenty-six reconciler-owned tables remain | JT-019 email-provider transfer complete; dependent CV/career groups continue incrementally |
|
||||
| V-199 | Ownership/migration chain; populated adoption/downgrade/retry; FK/index assertions; MariaDB script; full backend | Repository root / disposable local SQLite | Move CV upload artifacts and extraction runs to migration ownership without losing import history | PASS — focused ownership/migration 11/11; artifact hash and structured result survive adoption, downgrade and re-upgrade; all three indexes exist; artifact deletion sets the run link null; generated MariaDB SQL contains provider-safe parent/child DDL; startup creates neither table; full backend 727/727 | MariaDB SQL generated only; no provider account or production migration. Guarded MariaDB index/auto-increment repairs remain temporarily. Twenty-four reconciler-owned tables remain | JT-019 CV extraction persistence transfer complete; tailored CV and career groups continue incrementally |
|
||||
| V-200 | Ownership/migration chain; populated adoption/downgrade/retry; FK/index assertions; MariaDB script; full backend | Repository root / disposable local SQLite | Move job-specific tailored CV drafts to migration ownership without losing generated or edited content | PASS — focused ownership/migration 12/12; summary, custom-section and context data survive adoption, downgrade and re-upgrade; both indexes exist; deleting the parent application cascades to the draft; generated MariaDB SQL is provider-safe; startup no longer creates the table; full backend 728/728 | MariaDB SQL generated only; no provider account or production migration. Guarded MariaDB index/auto-increment repairs remain temporarily. Twenty-three reconciler-owned tables remain | JT-019 tailored CV transfer complete; career-profile aggregate remains a dependency-aware future batch |
|
||||
| V-201 | Ownership/migration chain; populated adoption/downgrade/retry; FK/index assertions; MariaDB script; full backend | Repository root / disposable local SQLite | Move persisted interview-preparation and irregular AI workspace notes to migration ownership without losing reviewed outputs | PASS — focused ownership/migration 13/13; interview summary and candidate-fit JSON survive adoption, downgrade and re-upgrade; both uniqueness indexes exist; deleting the parent application cascades through both tables; generated MariaDB SQL is provider-safe; startup creates neither table; full backend 729/729 | MariaDB SQL generated only; no provider account or production migration. Guarded MariaDB index/auto-increment repairs remain temporarily. Twenty-one reconciler-owned tables remain | JT-019 job-workspace note transfer complete; CV variants and career-profile aggregates remain dependency-aware batches |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,6 +29,8 @@ cohesive table groups. It does not attempt to delete the legacy reconciler whole
|
||||
parsed output and the nullable `ON DELETE SET NULL` artifact relationship.
|
||||
- Added `20260830126000_AdoptTailoredCvDraftSchema` for the job-specific tailored document, retaining
|
||||
generated and manually edited content plus its `ON DELETE CASCADE` application relationship.
|
||||
- Added `20260830127000_AdoptJobWorkspaceNotesSchema` for interview preparation and irregular AI
|
||||
workspace results, retaining reviewed output and both application cascade relationships.
|
||||
- Corrected the ownership runbook: new tables now default to migrations; the reconciler is legacy
|
||||
compatibility code to retire one dependency group at a time.
|
||||
|
||||
@@ -56,14 +58,16 @@ migration.
|
||||
and re-upgrade; deleting the artifact preserves the run and clears its nullable relationship.
|
||||
- A representative tailored CV's summary, custom section, and generation context survive adoption,
|
||||
downgrade, and re-upgrade; deleting the parent application still deletes its draft.
|
||||
- Representative interview-preparation and candidate-fit outputs survive adoption, downgrade, and
|
||||
re-upgrade; deleting the parent application still deletes both cached note types.
|
||||
- Generated MariaDB SQL contains the provider-correct `SystemEmailSettings` DDL.
|
||||
- Full backend: 728/728 passed after the tailored CV draft transfer.
|
||||
- Full backend: 729/729 passed after the job-workspace note transfer.
|
||||
- Fresh application startup over a new disposable SQLite database applied
|
||||
`20260830120000_AdoptSystemEmailSettingsSchema` and reached the healthy listening state.
|
||||
|
||||
## Remaining JT-019 work
|
||||
|
||||
Twenty-three model tables remain startup-created, including the Identity group and several tables
|
||||
Twenty-one model tables remain startup-created, including the Identity group and several tables
|
||||
with parent dependencies. Transfer them in small dependency-aware migrations with blank, populated,
|
||||
retry and MariaDB runtime proof. Column/index repairs must remain until historical upgrade fixtures
|
||||
prove each one redundant.
|
||||
|
||||
@@ -50,6 +50,7 @@ Updated: 2026-08-30
|
||||
- Moved Gmail, Microsoft Graph, and IMAP connection records into one provider-aware migration; encrypted credentials, sync state, uniqueness constraints, and historical repair paths are preserved.
|
||||
- Moved CV upload artifacts and extraction runs into a provider-aware migration; existing hashes, structured results, indexes, and nullable artifact retention semantics are preserved.
|
||||
- Moved job-specific tailored CV drafts into a provider-aware migration; generated and edited content, indexes, and application cascade semantics are preserved.
|
||||
- Moved persisted interview-preparation and AI workspace notes into one provider-aware migration; reviewed outputs, uniqueness, and application cascades are preserved.
|
||||
|
||||
### In progress
|
||||
|
||||
@@ -80,7 +81,7 @@ Updated: 2026-08-30
|
||||
- Focused frontend: 2 suites, 6 tests passed.
|
||||
- Full frontend: 64 suites, 272 tests passed.
|
||||
- Next production build and TypeScript: passed.
|
||||
- Full backend: 728/728 tests passed after the tailored CV JT-019 transfer.
|
||||
- Full backend: 729/729 tests passed after the job-workspace notes JT-019 transfer.
|
||||
- Portable Playwright launcher: resolved the user-local .NET 9 SDK; backend Release build passed with 0 warnings/errors.
|
||||
- Playwright: initial full run 9/10 exposed the intentional mobile Settings control change; updated focused rerun passed 1/1. A final complete browser rerun remains in the end-of-batch gate.
|
||||
- Focused backend match/intelligence verification: 34/34 passed.
|
||||
|
||||
Reference in New Issue
Block a user