Repository navigation
fix(migrator): read the pre-3.0 null column option as an alias of allowNull - #4395
Conversation
…owNull Before 3.0 a migration column's nullability option was `null`; 3.0 renamed it `allowNull` with no alias, so `null` was ignored and a `null = false` column was created nullable. Column functions, column() and references() read it again (arguments["null"]): `allowNull` wins when both are passed, and the deprecation is logged once per migration run. `wheels upgrade check` lists migrations that use null=false (with what to check before tightening) and null=true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Peter Amiri <peter@alurium.com>
|
rev1-r3 review @ c7017ae: code APPROVE (final sign-off after matrix run 37365306608 and PR CI); one merge-order note for whichever of this and #4393 lands second
Merge order with #4393 (both touch |
Wheels Test Results227 092 tests 221 971 ✅ 1h 23m 27s ⏱️ Results for commit c7017ae. ♻️ This comment has been updated with latest results. |
|
rev1-r3 review @ c7017ae: APPROVE (final) Matrix 37379851062 (fresh full run on this head, dispatched after the outage) completed with success: 32 of 32 legs have tests > 0 (7091–7108 each) and 0 failures and 0 errors on every leg. PR CI is 28 pass / 0 fail / 0 pending, with 2 skipping. That includes the LuCLI job ( Ready to merge. Merge-order note with #4393, which is still open and also edits |
Migration column option
nullis read againBefore Wheels 3.0, a migration column's nullability option was called
null. 3.0 renamed itallowNullwith no alias, so from 3.0 through 4.1nullwas silently ignored. With noallowNull, noNULL/NOT NULLclause is emitted, and the column gets the database's default, nullable on most databases. A 2.x migration'st.string(columnNames = "email", null = false)has created a nullable column ever since.nullis now a deprecated alias ofallowNullagain, in the typed column functions (t.string()and the others),t.column()andt.references():allowNullwins when both are passed.arguments["null"], neverarguments.null, sincenullis a keyword on some engines.wheels.logonce per request (one migration run), not once per column.references()staysNOT NULLby default. ItsallowNull = falsedefault moved from the signature into the body, so it can tell a passedallowNullfrom the default.wheels upgrade checklistsnull=migrationsTwo advisories for an upgrade to 4.2, scanning
app/migrator/migrationswith comments stripped:null=false. Wheels 3.0 through 4.1 created these columns nullable, so the running database may holdNULLrows in them. A database rebuilt on 4.2 from the same migrations getsNOT NULLcolumns, stricter than the one in production. The advice is to check each column forNULLrows before tightening it, and to renamenulltoallowNull.null=true. Rename it toallowNull.Docs
null" section, with the three steps fornull=falsecolumns.fixedfragment.Specs
vendor/wheels/tests/specs/migrator/nullAliasSpec.cfcpassesnullthroughargumentCollection(RustCFML can't parsenull = xas a named argument). No table is created.nullsetsallowNullon typed functions (falseandtrue), oncolumn()and onreferences().allowNullwins overnull, on a typed function and onreferences().references()defaults toNOT NULL.cli/lucli/tests/specs/commands/UpgradeCheck4x2Spec.cfc:null=falseandnull=truelines are listed separately, with file and line.allowNull=falseand a commented-outnull=falsearen't listed.RED on develop: the typed-function and
column()/references()cases fail (noallowNullis set), and so does the deprecation case.GREEN:
🤖 Generated with Claude Code