Commit 8321cd4
committed
fix(docs): make the reference schema actually valid
Validated the schema block with prisma@7.9.0 instead of trusting it by
inspection. It reported 182 errors; the causes were three:
- Prisma enums require one value per line. Writing them compactly produced
146 cascading errors, including bogus "attribute not known" reports on
perfectly good @@index lines.
- Organization declared assets, alerts, risks, incidents and documents, but
those models had no inverse relation field. Prisma needs both sides, so
the FK that guarantees a record cannot outlive its tenant was missing.
- Prisma 7 removed url from the datasource block: the connection string now
belongs to prisma.config.ts and to a driver adapter passed to
PrismaClient. Documented, with the consequence for our env variables.
The schema now validates. Also corrected two internal inconsistencies:
ScoreBreakdown is generic over its band, because a vessel is READY while an
organization is NORMAL and neither vocabulary should be assignable to the
other; and the Phase 6 acceptance criterion no longer promises a band
transition that the formula does not produce (100 to 85 is still Ready) —
it asserts the arithmetic instead. A test that demanded a band change would
push someone to inflate the asset weight to make it pass.
Documenting a schema that does not compile is the same failure this project
criticises elsewhere, so DATABASE.md now records that it was verified.1 parent 652b010 commit 8321cd4
6 files changed
Lines changed: 217 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
259 | 265 | | |
260 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
261 | 270 | | |
262 | | - | |
| 271 | + | |
263 | 272 | | |
264 | 273 | | |
265 | 274 | | |
| |||
287 | 296 | | |
288 | 297 | | |
289 | 298 | | |
290 | | - | |
| 299 | + | |
291 | 300 | | |
292 | 301 | | |
293 | 302 | | |
| |||
296 | 305 | | |
297 | 306 | | |
298 | 307 | | |
299 | | - | |
| 308 | + | |
300 | 309 | | |
301 | 310 | | |
302 | 311 | | |
| |||
420 | 429 | | |
421 | 430 | | |
422 | 431 | | |
423 | | - | |
| 432 | + | |
424 | 433 | | |
425 | 434 | | |
426 | 435 | | |
| |||
528 | 537 | | |
529 | 538 | | |
530 | 539 | | |
531 | | - | |
| 540 | + | |
532 | 541 | | |
533 | 542 | | |
534 | 543 | | |
| |||
0 commit comments