Fix LONGTEXT columns becoming TEXT in generated migrations#1050
Merged
Fix LONGTEXT columns becoming TEXT in generated migrations#1050
Conversation
The issue was a mismatch between CakePHP's LENGTH_LONG constant (4294967295) and migrations' TEXT_LONG constant (2147483647). When using `bake migration_diff`, CakePHP's schema reflection returns LENGTH_LONG for LONGTEXT columns, but MysqlAdapter expected TEXT_LONG. This fix: 1. MigrationHelper: Convert LENGTH_LONG to TEXT_LONG when generating migrations 2. MysqlAdapter: Accept both constants for backward compatibility with existing migrations that have the wrong value Fixes #1029
fc84c5f to
6b8f60d
Compare
jamisonbryant
approved these changes
Mar 12, 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.
Summary
Fixes the issue where LONGTEXT columns were being generated as TEXT when using
bake migration_diff.Root cause: Mismatch between CakePHP's
LENGTH_LONGconstant (4294967295) and migrations'TEXT_LONGconstant (2147483647).Changes:
MigrationHelper::getColumnOption()- ConvertLENGTH_LONGtoTEXT_LONGwhen generating migrations, so new migrations get the correct valueMysqlAdapter::mapColumnData()- Accept both constants for backward compatibility, so existing migrations with4294967295still workNote:
LENGTH_TINY(255) andLENGTH_MEDIUM(16777215) already matchTEXT_TINYandTEXT_MEDIUM, so onlyLENGTH_LONGneeds conversion.Fixes #1029