Fix MySQL 8.0.19+ integer display width compatibility#89
Merged
hidu merged 1 commit intohidu:masterfrom Oct 28, 2025
Merged
Conversation
MySQL 8.0.19+ deprecated display width for integer types (int(11) -> int), causing false positive schema differences. Add normalizeIntegerType() function to handle this compatibility issue. - Add normalizeIntegerType() in util.go to normalize integer types - Update FieldInfo.Equals() to use normalized comparison - Add comprehensive unit tests for the new function - Add integration tests in field_test.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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
This PR fixes the false positive schema differences when comparing between MySQL 5.7 and MySQL 8.0.19+, addressing issue #78.
Problem
MySQL 8.0.19+ deprecated and removed the display width for integer data types:
int(11),bigint(20),tinyint(1)int,bigint,tinyintThis causes constant false positives when syncing schemas between different MySQL versions, as the tool reports differences even though the column definitions are functionally equivalent.
Solution
Added a
normalizeIntegerType()function that:unsigned,zerofill,unsigned zerofilltinyint,smallint,mediumint,int,bigintUpdated
FieldInfo.Equals()to use normalized type comparison, ensuringint(11)andintare treated as equivalent.Changes
normalizeIntegerType()function with comprehensive documentationFieldInfo.Equals()to use normalized integer type comparisonTest Coverage
All tests pass with comprehensive coverage:
Closes
Fixes #78
🤖 Generated with Claude Code