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
+6 -2
View File
@@ -33,6 +33,8 @@ cohesive table groups. It does not attempt to delete the legacy reconciler whole
workspace results, retaining reviewed output and both application cascade relationships.
- Added `20260830128000_AdoptCvVariantSchema` for saved CVs and their append-only revision history,
retaining public slugs, builder settings, and job-link/version retention semantics.
- Added `20260830129000_AdoptAiInteractionSchema` to take ownership from both the startup reconciler
and historical compatibility bootstrap while retaining append-only results and usage counters.
- Corrected the ownership runbook: new tables now default to migrations; the reconciler is legacy
compatibility code to retire one dependency group at a time.
@@ -64,14 +66,16 @@ migration.
re-upgrade; deleting the parent application still deletes both cached note types.
- A representative CV and two saved revisions survive adoption, downgrade, and re-upgrade; deleting
its job clears only the optional link, while deleting the CV cascades through its revisions.
- A representative AI result, mode, provider, and usage counts survive adoption, downgrade, and
re-upgrade; deleting the parent application still cascades through its interaction history.
- Generated MariaDB SQL contains the provider-correct `SystemEmailSettings` DDL.
- Full backend: 730/730 passed after the CV variant and history transfer.
- Full backend: 731/731 passed after the AI interaction history transfer.
- Fresh application startup over a new disposable SQLite database applied
`20260830120000_AdoptSystemEmailSettingsSchema` and reached the healthy listening state.
## Remaining JT-019 work
Nineteen model tables remain startup-created, including the Identity group and several tables
Eighteen 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.