Skip to content

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Jan 28, 2026

Summary

  • Adds support for the fixed attribute on binary columns to distinguish between fixed-length BINARY and variable-length VARBINARY types
  • When reflecting a BINARY(n) column from the database, fixed => true is now passed through to the Column object
  • When baking migrations, the fixed option is now included in the generated migration code

This is the companion PR to cakephp/cakephp#19207 which adds the core framework support for this feature.

Usage

// Creates VARBINARY(20) - variable length (default)
$table->addColumn('data', 'binary', ['length' => 20]);

// Creates BINARY(20) - fixed length  
$table->addColumn('hash', 'binary', ['length' => 20, 'fixed' => true]);

Refs #999


Constraint: This one doesnt technically need one.

Also, even if, since #1013 is raising the constraint already, I skipped it for this PR here.

Add support for the `fixed` attribute on binary columns to distinguish
between fixed-length BINARY and variable-length VARBINARY types.
This mirrors cakephp/cakephp#19207.
Tests cover:
- Column class getter/setter for fixed option
- Column::toArray() including fixed in output
- Column::setOptions() accepting fixed option
- MigrationHelper::getColumnOption() including/excluding fixed
- MysqlAdapter creating BINARY vs VARBINARY based on fixed option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants