I let Claude do some more research on this in the source code:
The error is a mismatch between your schema and EF Core’s bookkeeping, not a broken migration.
The umbracoOpenIddict* tables are created by EF Core, and EF decides what to run purely from the __EFMigrationsHistory table. Your tables exist, but the AddOpenIddict row in that history table is missing — so on boot Umbraco’s pre-migration (UpdateToOpenIddictV5, then UpdateToOpenIddictV7) re-runs everything up to its target and tries to CREATE TABLE again. Same root cause as #16117, which has more detail.
Check what you’ve actually got:
SELECT MigrationId FROM __EFMigrationsHistory ORDER BY MigrationId;
SELECT name FROM sys.tables WHERE name LIKE 'umbracoOpenIddict%';
Don’t just drop umbracoOpenIddictApplications — the error will move to umbracoOpenIddictScopes next. Schema and history have to agree, so pick one:
Option A (recommended)
Backfill the two rows for work that’s already done, and let the v5/v7 migrations run normally:
INSERT INTO __EFMigrationsHistory (MigrationId, ProductVersion) VALUES
('20230622184303_InitialCreate', '10.0.10'),
('20230807654321_AddOpenIddict', '10.0.10');
SQLite uses different IDs: 20230622183638_InitialCreate and 20230807123456_AddOpenIddict. ProductVersion is informational only.
Option B
Drop all four umbracoOpenIddict* tables and delete their history rows. No data loss worth worrying about — those tables hold the backoffice client registration, which is re-created on boot, plus active tokens, so everyone just logs in again.
Either way, afterwards confirm umbracoOpenIddictApplications has ClientType, ApplicationType, JsonWebKeySet and Settings (added by the v5 migration) and that umbracoOpenIddictTokens.Type is nvarchar(150) (v7). If those are missing you’ll hit Invalid column name errors instead.
Worth noting this seems to hit databases whose lineage goes back through v11/v12 — HQ has never been able to reproduce it, which is why #14992 is still open. If you can share what your database’s upgrade history looks like, that’d be genuinely useful on that issue.