Commit 000fd05
fix(cli): generated migrations emit the character column driver-sql creates (#16298)
* fix(cli): generated migrations emit the character column driver-sql creates (#16091)
Both migration generators capped a `text` field at VARCHAR(255) while
`driver-sql` creates an unbounded `text` column for it, so a 300-character
value the platform stores was refused by every generated table with
`value too long for type character varying(255)`. #15521's ruling names this
card and settles its direction -- the generator follows the driver, as #15040
already did for the `id` column in this same file.
Driven on a private PostgreSQL 16.13 cluster, all three producers run from one
object and their columns read back out of `information_schema.columns`. The
sweep found nine divergent columns of 26 probed, not one:
text driver text gen varchar(255) both formats
text+max driver text gen varchar(255) maxLength must NOT size it
email+max driver varchar(400) gen varchar(255) maxLength was never read
url driver varchar(255) sql varchar(2048) invented width
phone driver varchar(255) sql varchar(50) invented width
color driver varchar(255) sql varchar(7) invented width
All of them now follow `createColumn`'s three arms. The text family is
unbounded, because that arm branches on KEYED and a generated migration emits
no index; its declared bound is enforced at the write seam, not by the column.
The string family takes `declaredVarcharLength`'s answer -- the declaration
verbatim in both directions, knex's 255 without one, and TEXT above the
varchar ceiling rather than a clamp to it. The catch-all keeps the default
width and ignores a declaration, because its stored value is an option code or
another row's id rather than the declared string.
Driven again afterwards: 0 of 26 columns diverge, and the 300-character write
is accepted in all three tables exactly where the platform accepts it and
refused in all three exactly where the platform refuses it.
`generate-string-family-width.pin.test.ts` asserts that agreement against the
driver's own source -- arm membership read from `createColumn`'s case labels,
widths read from its own constants -- so a driver that moves fails there
instead of leaving the generators quietly wrong. Three existing pin files move
with it: two used `text`'s old VARCHAR(255) as a stand-in for the driver's
default string column, and one asserted column ordering by searching for a
`table.string` call that is now a `table.text` call.
Scope is PostgreSQL, the only dialect `--format sql` claims (#15521). The
FILE_REFERENCE_TYPES divergence stays recorded and unresolved (#15041).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D47qPfEWVPmhguWgBZCi5N
* chore(changeset): grade `@objectstack/cli` minor, the level a declared clause-② requires
`Check Changeset`'s LEVEL AXIS (#16055) refuses a PR that declares clause-② YES
while grading a package whose `packages/*/src/**` it moves as `patch`. The rule
it mechanizes is the maintainer's 2026-09-04 ruling (decision batch #35, on
#15294), written out under "WHICH LEVEL" in that step: a purely additive
widening of a published package's public surface takes AT LEAST `minor`, and
the commit type may raise a bump but never lower it below what the act
requires.
This branch declares clause-② `yes` and moves `packages/cli/src/**`, so the
level and the declaration contradicted each other. Only the level moves here --
the generators, the pins and the measurements are untouched.
1 parent 3890244 commit 000fd05
6 files changed
Lines changed: 2192 additions & 19 deletions
Lines changed: 13 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 | + | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
230 | 236 | | |
231 | 237 | | |
232 | 238 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
571 | 582 | | |
572 | 583 | | |
573 | 584 | | |
| |||
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
| |||
285 | 291 | | |
286 | 292 | | |
287 | 293 | | |
288 | | - | |
289 | | - | |
| 294 | + | |
| 295 | + | |
290 | 296 | | |
291 | 297 | | |
292 | 298 | | |
| |||
0 commit comments