Commit 08706f0
fix(cli):
* fix(cli): generate migration emits the columns the platform creates (#14828)
Five field-type vocabulary entries in packages/cli/src/commands/generate.ts
keyed on real FieldType members and described DDL driver-sql does not create.
Each value is now read from the driver, the emitter that creates the real
columns:
autonumber SERIAL -> VARCHAR(255) (a RENDERED string, table.string)
multiselect TEXT -> JSONB (MULTI_OPTION_TYPES seeds JSON)
vector VECTOR -> JSONB (STRUCTURED_JSON_TYPES; not portable)
formula TEXT -> no column (virtual: createColumn returns)
lookup/md uuid, 36 -> table.string, VARCHAR(255) (a platform id is
26 chars; Postgres 22P02 on uuid)
user/tree move with lookup/master_detail so REFERENCE_VALUE_TYPES keeps one
answer: a reference column holds the target's id, and the driver emits that as
table.string('id').primary().
The rule is derived, not retyped. generate-field-type-vocabulary.pin.test.ts
sweeps the spec's ADR-0104 D1 value classes and source-reads createColumn's own
switch; #14829's scope fence in generate-multiple-json-column.pin.test.ts is
discharged in place rather than deleted or routed around.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
* fix(cli): select the virtual answer by own-property presence, not nullish-coalescing (#14828)
Three defects the new pin caught on its first run, all real:
1. `FIELD_TYPE_SQL_MAP[fieldType] ?? 'TEXT'` still emitted `"f" TEXT` for a
formula field — `??` falls through on `null`, which is exactly the value
that means "virtual". Own-property presence is the only spelling that
distinguishes "absent" (the unvalidated authoring door) from "no column",
and `hasOwnProperty` rather than `in` because `in` answers true for
`toString` and every other inherited key.
2. The pin's createColumn arm extractor stopped ON the terminator, dropping the
trailing same-line comment the driver states the arm's reason in.
3. The within-file rule "a string on the record takes a character column" was
too strong: `date` / `datetime` / `time` are strings on the record and take
temporal columns correctly. Narrowed to what `autonumber` actually did — a
rendered string in a column that only accepts numbers — with the predicate
itself controlled against SERIAL and a genuinely numeric member.
44/44 green across both pins.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
* tooling(cli): declare field.zod.ts as a cross-package test input (#14828)
#14828 gave generate-field-type-vocabulary.pin.test.ts its first cross-package
READ — driver-sql's sql-driver.ts and schema-drift.ts, the authority on which
column each field type gets. That is what brings a file into
check:cross-package-test-inputs' scan at all, and the flat literal collector
then took the one quoted path already in its header prose: the
packages/spec/src/data/field.zod.ts that #13871 cites as the file it ran
`git log -S` over.
Declared rather than reworded, exactly as translation.zod.ts was for the same
shape, and honestly rather than as a shrug: field.zod.ts DEFINES the FieldType
enum this pin asserts totality over, so a member added there is precisely the
change that must re-run this suite.
Control run: restoring only the pin file to its pre-card bytes turns the gate
green again (exit 0, "25 package(s) read outside themselves, all declared"),
which is what identifies this card's read as the cause rather than a
pre-existing miss.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
---------
Co-authored-by: Claude <noreply@anthropic.com>os generate migration emits the columns the platform actually creates (#15076)1 parent d261cef commit 08706f0
6 files changed
Lines changed: 630 additions & 62 deletions
File tree
- .changeset
- packages/cli/src/commands
- scripts
Lines changed: 56 additions & 0 deletions
| 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 | + | |
0 commit comments