Commit b7f645a
`driver-sql` materializes uniqueness from two declaration surfaces. #13197
closed the field-level one here; object-level declared `indexes[]` entries
carrying `unique` were still declared-and-not-enforced, so a composite unique
was a real constraint on the SQL family and nothing at all in memory — the
colliding write landed and a read returned both rows.
- `normalizeDeclaredIndex`'s arms are reproduced (not imported — this package
must not depend on `driver-sql`), including the #4986 trap: on a DECLARED
index bare `unique: true` is the positional spelling of `'global'`, the
opposite of the field surface, so the scope test is the strict
`unique === 'organization'`.
- Both surfaces share one key model, so there is exactly one NULL rule: a NULL
in any listed key column exempts the row, while a NULL organization folds onto
one bucket. Measured against SQLite over both DDL shapes
`syncDeclaredIndexes` emits, not assumed.
- The refusal is the same ADR-0112 envelope, stamped in one place for both
surfaces. It names the key COLUMNS and no index name, so
`uniqueViolationColumn` answers `undefined` — what `driver-sql` answers for a
composite, and the safe answer under #6544.
- The `memory-unique-constraint.ts` docblock sentence that listed this surface
under "Deliberately out of scope" is removed, not left standing.
Claude-Session: https://claude.ai/code/session_01LZbWd2jNV1FErXTPSS4Dry
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 63cf416 commit b7f645a
5 files changed
Lines changed: 1013 additions & 47 deletions
File tree
- .changeset
- packages/drivers/driver-memory/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 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
37 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
| |||
0 commit comments