db-mysql
db-mysql copied to clipboard
Type blob is generated instead of binary Mysql 8.0
The field type binary(16) is converted to the blob type. MySQL 8.0 also has a binary type.
Example
$b->createTable('urls', [
'id' => $b->bigPrimaryKey()->unsigned(),
'hash' => $b->binary(16)->notNull()->comment('md5 from url')->asString(), // md5 binary
'url' => $b->text()->notNull(),
'create' => $b->timestamp()->notNull()->defaultExpression('CURRENT_TIMESTAMP')
]);
Result:
CREATE TABLE urls (
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
hash blob NOT NULL COMMENT 'md5 from url',
url text NOT NULL,
create timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
Please version Mysql .
Please version
Mysql.
My version: mysql Ver 8.0.32-0ubuntu0.20.04.2 for Linux on x86_64
https://github.com/yiisoft/yii2/blob/f388ca71b08b89e940f1ffbe4afa19ae9d5e115f/framework/db/mysql/QueryBuilder.php#L45 Here is the mapping to blob, we'll check.