-
Notifications
You must be signed in to change notification settings - Fork 121
Add fixed option for binary column type #1014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.x
Are you sure you want to change the base?
Conversation
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
| public function setFixed(bool $fixed) | ||
| { | ||
| $this->fixed = $fixed; | ||
|
|
||
| return $this; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should eventually raise the version constraint so that we can remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a TODO here in code? Or just track this for a future cleanup in some ticket?
| $this->assertNotNull($hashCol); | ||
| $this->assertNotNull($dataCol); | ||
| $this->assertTrue($hashCol->getFixed()); | ||
| $this->assertNull($dataCol->getFixed()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also have an assertion on the column types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
We need to wait with final merge and bugfix release until core patch has been released it seems. |
Summary
fixedattribute on binary columns to distinguish between fixed-lengthBINARYand variable-lengthVARBINARYtypesBINARY(n)column from the database,fixed => trueis now passed through to the Column objectfixedoption is now included in the generated migration codeThis is the companion PR to cakephp/cakephp#19207 which adds the core framework support for this feature.
Usage
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.