Skip to content

Skip ROW_FORMAT=FIXED for InnoDB to avoid MySQL 8 error 1031#69

Merged
rick-lam merged 1 commit into
masterfrom
skip-row-format-fixed-innodb
Apr 30, 2026
Merged

Skip ROW_FORMAT=FIXED for InnoDB to avoid MySQL 8 error 1031#69
rick-lam merged 1 commit into
masterfrom
skip-row-format-fixed-innodb

Conversation

@rick-lam
Copy link
Copy Markdown
Collaborator

Summary

  • ROW_FORMAT=FIXED is only valid for MyISAM. MySQL 5.6 silently downgraded it to COMPACT for InnoDB; MySQL 8 rejects it with ERROR 1031: Table storage engine for '<table>' doesn't have this option, breaking morphism diff --apply-changes=yes on schemas that legacy databases were created with.
  • This is the same flavour of MySQL 8 compatibility cleanup as Remove int width and zerofill for > MySQL 8.0.19 #67 (int display width / zerofill).

Change

  • src/Parse/TableOptions.phptoString() skips emitting ROW_FORMAT=FIXED when the engine is InnoDB.
  • src/Extractor.phpgetTableOptionDefs() skips ROW_FORMAT when INFORMATION_SCHEMA reports FIXED on an InnoDB table.
  • Both sites only suppress the FIXED + InnoDB combination. MyISAM still preserves ROW_FORMAT=FIXED, and other formats (DYNAMIC, COMPRESSED, REDUNDANT, COMPACT) are unchanged.

Test plan

  • make test-unit (via graze/php-alpine:7.4-test): 727/727 pass.
  • Updated tests/Parse/TableOptionsTest.php:
    • row_format=fixed on default (InnoDB) engine now expects ENGINE=InnoDB (no ROW_FORMAT).
    • New case: engine=MyISAM row_format=fixed still expects ENGINE=MyISAM ROW_FORMAT=FIXED.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 30, 2026 15:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=FIXED for InnoDB in TableOptions::toString().
  • Suppress extracted ROW_FORMAT=FIXED for InnoDB in Extractor::getTableOptionDefs() when INFORMATION_SCHEMA reports it.
  • Update unit tests to reflect the new behavior and ensure MyISAM still preserves ROW_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>
@rick-lam rick-lam force-pushed the skip-row-format-fixed-innodb branch from 1d927a1 to d33b1af Compare April 30, 2026 16:16
@rick-lam rick-lam merged commit 5babe0c into master Apr 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants