Repository navigation
Schema: repair lossless type drift, and gate a real 1.5 upgrade - #2007
Merged
Merged
Conversation
A 1.5 server's schema count lands on a different 1.6 step whenever 1.5 adds one, and the updater skips every 1.6 step below it. plan() puts back the tables and columns those steps created, but a step that changed an existing column's type was lost, and only shapeDrift() reported it. That is how users.uName kept 1.5's varchar(40) (GH-2000). repairShape() now applies the drift that cannot lose data: a longer varchar/char/varbinary/binary, a wider integer of the same signedness, and NOT NULL -> NULL. The MODIFY keeps the live column's charset, collation and AUTO_INCREMENT. Everything else stays report-only. It runs before the foreign keys, since a widened child is what lets one land. tests/upgrade-from-15-ci.test.sh installs the schema with 1.5's own updater (from origin/stable by default), upgrades with this tree's real updater, both served by Apache in a php:7.4 container, and fails on an update error, a short version, shape drift, or a lost AUTO_INCREMENT. Without a database it skips. It fails on each of the three defects found today: the pre-#2001 tree at step 290, this repair without AUTO_INCREMENT at step 419, and the tree without this repair on the two users columns. Refs #2000 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A 1.5 server's schema count lands on a different 1.6 step whenever 1.5 adds one, and the updater skips every 1.6 step below that count.
SchemaReconciler::plan()puts back the tables and columns that the skipped steps created. A skipped step that changed an existing column's type was lost, andshapeDrift()only reported it. That is howusers.uNamekept 1.5'svarchar(40)(#2000, fixed for that one column by #2005). No CI job could see any of this, because the rehearsal builds its start from 1.6's own steps.Fix
Repair (this reopens GH-1542's "report, never repair", now for changes that cannot lose data).
repairShape()applies only drift where every stored value fits unchanged:varchar/char/varbinary/binary;NOT NULL→NULL.The
MODIFYkeeps the live column's charset, collation andAUTO_INCREMENT. A narrower type, a different type,NULL→NOT NULL, or an enum → tinyint stays report-only. A repair the server refuses is logged, and the update still completes. The repair runs before the foreign keys, because a widened child column is what lets its constraint land.Gate.
tests/upgrade-from-15-ci.test.sh:origin/stableby default;SchemaUpdaterPage, both trees under Apache in aphp:7.4container (1.5 reads the request throughfilter_input(INPUT_SERVER), whichphp -Sand php-cgi leave NULL);FOG_SCHEMA, any shape drift, or a lostAUTO_INCREMENT.Each tree's config is rendered from its own installer template. FOGProject/fog-workflows#44 runs the gate twice, once from
stableand once fromdev-branch. Without a database, the script skips.Tests
The gate fails on each defect found today:
AUTO_INCREMENThandlingmodules.idand droppedAUTO_INCREMENT. The gate caught this in the first draft of this PRusers.uNameandusers.uCreateBystable(c97e205) and fromdev-branch(17973cd)AUTO_INCREMENTintacttests/schema-reconciler-lossless-repair.test.php: 20 checks on the repair planner, for each lossless case and each refused case.schema-shape-drift,role-name-unique-restoredandschema-manifest-consistentpass.Refs #2000, GH-1542
🤖 Generated with Claude Code