refactor(db): migrate email connections

Move Gmail, Microsoft Graph, and IMAP connection creation into an additive provider-aware migration. Preserve encrypted credentials and retain scoped historical repairs.
This commit is contained in:
cesnimda
2026-08-30 16:56:14 +02:00
parent 2e2d649f6f
commit 6c50e406b5
9 changed files with 274 additions and 163 deletions
+7 -2
View File
@@ -22,6 +22,9 @@ cohesive table groups. It does not attempt to delete the legacy reconciler whole
- Added `20260830123000_AdoptAuthenticationSupportSchema` for recovery codes, trusted devices, and
revocable user sessions; both provider startup-create paths are removed while guarded MariaDB
repair checks remain for historical schemas.
- Added `20260830124000_AdoptEmailConnectionSchema` for Gmail, Microsoft Graph, and IMAP connection
records. Encrypted credentials and sync state are retained; scoped Gmail column repair and guarded
MariaDB index/identity repair remain for historical installations.
- Corrected the ownership runbook: new tables now default to migrations; the reconciler is legacy
compatibility code to retire one dependency group at a time.
@@ -43,14 +46,16 @@ migration.
- A representative Gmail review decision survives adoption, downgrade, and re-upgrade.
- Representative recovery-code, trusted-device, and user-session rows survive adoption, downgrade,
and re-upgrade, and their indexes are present afterwards.
- Representative encrypted credentials for all three email providers survive adoption, downgrade,
and re-upgrade, and all five expected provider indexes are present afterwards.
- Generated MariaDB SQL contains the provider-correct `SystemEmailSettings` DDL.
- Full backend: 725/725 passed after the authentication-support transfer.
- Full backend: 726/726 passed after the email-provider connection transfer.
- Fresh application startup over a new disposable SQLite database applied
`20260830120000_AdoptSystemEmailSettingsSchema` and reached the healthy listening state.
## Remaining JT-019 work
Twenty-nine model tables remain startup-created, including the Identity group and several tables
Twenty-six 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.