-
Notifications
You must be signed in to change notification settings - Fork 120
Closed
Labels
Milestone
Description
This is a (multiple allowed):
-
bug
-
enhancement
-
feature-discussion (RFC)
-
CakePHP Version: 4.2.2
-
Platform and Target: Windows 10 (XAMPP) PHP 7.2, 10.1.35-MariaDB
What you did
I have some BLOB and MEDIUMBLOB columns on Database:
-- EXAMPLE
CREATE TABLE `measures` (
`id` int(11) NOT NULL,
`title` blob NOT NULL,
`text` mediumblob NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`deleted` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;What happened
This is the resulting code after running bin/cake bake migration_diff measures:
$this->table('measures')
->addColumn('title', 'binary', [
'default' => null,
'limit' => null, // <----- PROBLEM HERE
'null' => false,
])
->addColumn('text', 'binary', [
'default' => null,
'limit' => 16777215,
'null' => false,
])The problem is that when you run that migration in another machine using bin/cake migrations migrate
the resulting column type for title is not BLOB but BINARY(255)

What you expected to happen
If ColumnType is BLOB, the limit should be 65535. (Stack Overflow)
What you have tried
I edited the migration, replaced the 'limit' => null with 'limit' => 65535 and ran the migration in a blank database. It worked as espected.
