Skip to content

Conversation

@dereuromark
Copy link
Member

Summary

Adds a Rector rule to help users upgrade migration files for CakePHP 6.0 where TYPE_VARBINARY was added.

Related: cakephp/cakephp#19258

Transformations

Fixed-length binary (with fixed attribute):

// Before
$table->addColumn('hash', 'binary', ['length' => 32, 'fixed' => true]);

// After
$table->addColumn('hash', 'binary', ['length' => 32]);

Variable-length binary (without fixed attribute):

// Before
$table->addColumn('data', 'binary', ['length' => 255]);

// After
$table->addColumn('data', 'varbinary', ['length' => 255]);

Notes

  • This rule targets addColumn() calls in migration files
  • The fixed attribute is removed since binary type is now always fixed-length
  • Columns without fixed => true are converted to varbinary type

Adds a rector rule to help users upgrade to CakePHP 6.0 where
TYPE_VARBINARY was added:

- `addColumn('col', 'binary', ['fixed' => true])` becomes
  `addColumn('col', 'binary', [])` (remove fixed attribute)
- `addColumn('col', 'binary', [...])` becomes
  `addColumn('col', 'varbinary', [...])` (change type)

See: cakephp/cakephp#19258
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.

1 participant