Repository navigation
Commit f98fa65
A brand-new empty SQLite file printed two `[schema-drift]` warnings before the
server was ready, both about the ADR-0048 overlay indexes the same boot had
just created. The second told the operator to
`os migrate apply --allow-destructive` away `idx_sys_metadata_overlay_draft` —
the unique index enforcing draft-overlay uniqueness.
Three fixes, all on the detector side (no metadata declaration changed:
`sys-metadata.object.ts` documents its four-column entry as the fallback shape
for drivers WITHOUT the runtime migration, and that contract still holds):
- Read the index key from its DEFINITION, not from the dialect's per-column
catalogue view. `PRAGMA index_info` reports a NULL column for an expression
key, so `(type, name, organization_id, COALESCE(package_id,''))` arrived as
three columns. SQLite/Postgres now parse `sqlite_master.sql` /
`pg_get_indexdef`, MySQL reads `STATISTICS.EXPRESSION` where available, and
`COALESCE(col, <literal>)` is attributed to `col`.
- Capture the partial predicate. An index `syncDeclaredIndexes` can neither
create nor rebuild is never claimed as ours, never called orphaned, and never
given a remedy this differ could not undo (`isSyncReproducibleIndex`).
- Keep a ledger of the index DDL the driver itself executed through raw
`execute()` — how `ensureOverlayIndex` issues its migration — so an index the
framework created on this boot is provably its own, including the plain-index
fallback it takes on dialects that reject partial indexes.
Genuine drift is untouched: orphaned generated indexes, redefined declared
indexes and the #3696 legacy-unique replacement are all still detected and
categorised exactly as before.
Claude-Session: https://claude.ai/code/session_01NrmBxj8rK2uGCnh9aipjwX
Co-authored-by: Claude <noreply@anthropic.com>
1 parent eb3e650 commit f98fa65
5 files changed
Lines changed: 858 additions & 24 deletions
File tree
- .changeset
- packages/plugins/driver-sql/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| 43 | + | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| |||
0 commit comments