Skip ROW_FORMAT=FIXED for InnoDB to avoid MySQL 8 error 1031#69
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves MySQL 8 compatibility by suppressing the invalid ROW_FORMAT=FIXED option when the table engine is InnoDB, preventing ERROR 1031 during schema diff/apply for legacy schemas.
Changes:
- Suppress emitting
ROW_FORMAT=FIXEDforInnoDBinTableOptions::toString(). - Suppress extracted
ROW_FORMAT=FIXEDforInnoDBinExtractor::getTableOptionDefs()when INFORMATION_SCHEMA reports it. - Update unit tests to reflect the new behavior and ensure
MyISAMstill preservesROW_FORMAT=FIXED.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Parse/TableOptionsTest.php | Updates expectations for row_format=fixed on default InnoDB and adds a MyISAM preservation case. |
| src/Parse/TableOptions.php | Skips emitting ROW_FORMAT=FIXED when engine is InnoDB to avoid MySQL 8 error 1031. |
| src/Extractor.php | Skips adding ROW_FORMAT=FIXED for InnoDB tables when extracting options from INFORMATION_SCHEMA. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ROW_FORMAT=FIXED is only valid for MyISAM. MySQL 5.6 and earlier silently downgraded it to COMPACT for InnoDB; MySQL 8 rejects it with `ERROR 1031: Table storage engine ... doesn't have this option`, which makes morphism diff/apply fail on tables that were originally defined with ROW_FORMAT=FIXED on an InnoDB engine. Drop ROW_FORMAT silently for InnoDB at both emission sites (the .sql parser in TableOptions::toString() and the live-DB extractor in Extractor::getTableOptionDefs()) so the resulting CREATE/ALTER statements run cleanly on MySQL 8. ROW_FORMAT=FIXED is preserved on MyISAM, where it remains valid. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1d927a1 to
d33b1af
Compare
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
ROW_FORMAT=FIXEDis only valid for MyISAM. MySQL 5.6 silently downgraded it toCOMPACTfor InnoDB; MySQL 8 rejects it withERROR 1031: Table storage engine for '<table>' doesn't have this option, breakingmorphism diff --apply-changes=yeson schemas that legacy databases were created with.Change
src/Parse/TableOptions.php—toString()skips emittingROW_FORMAT=FIXEDwhen the engine is InnoDB.src/Extractor.php—getTableOptionDefs()skipsROW_FORMATwhen INFORMATION_SCHEMA reportsFIXEDon an InnoDB table.FIXED+InnoDBcombination. MyISAM still preservesROW_FORMAT=FIXED, and other formats (DYNAMIC,COMPRESSED,REDUNDANT,COMPACT) are unchanged.Test plan
make test-unit(viagraze/php-alpine:7.4-test): 727/727 pass.tests/Parse/TableOptionsTest.php:row_format=fixedon default (InnoDB) engine now expectsENGINE=InnoDB(no ROW_FORMAT).engine=MyISAM row_format=fixedstill expectsENGINE=MyISAM ROW_FORMAT=FIXED.🤖 Generated with Claude Code