You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP Version: 7.2.2 ZTS MSVC15 (Visual C++ 2017) x64
Database Driver & Version: MariaDB 10.1.14
Description:
Else, ->collection('binary') could fails in some cases, because of the generated code is something like addressable_type varchar(255) collate binary not null (the correct is addressable_type varchar(255) collate "binary" not null).
I think that it should be applied to both: collaction and charset.
It affects MariaDB 10.1, but I don't know if it affects other DBMS and which versions.
I am not the best person to PR that, so if someone could do that, it will be very useful.
Steps to reproduce
Full test case:
Schema::create('addresses', function (Blueprint$blueprint) {
$blueprint->string('addressable_type')->collation(static::COLLATION_BINARY);
});
Code generated:
create table `platform_addresses` (`addressable_type` varchar(255) collate binary
not null) default character set utf8mb4 collate utf8mb4_unicode_ci
Code manually fixed:
create table `platform_addresses` (`addressable_type` varchar(255) collate "binary"
not null) default character set utf8mb4 collate utf8mb4_unicode_ci
The text was updated successfully, but these errors were encountered:
Both charset and collation supports binary as value. And binary is a reserved word for both MySQL and MariaDB, at least. But, binary could be used as value for character set as-in, but for collate it should be wrapped.
The code below should works:
Schema::create('example', function (Blueprint$blueprint) {
$blueprint->collation = '"binary"'; // Need be wrapped!$blueprint->charset = 'binary'; // Do not need be wrapped.$blueprint->increments('id');
});
Generated working SQL (beautified):
createtable `example`
(`id`int unsigned not null auto_increment primary key)
default character set binary
collate "binary"
So, I think that the wrapper should be applied only to collation.
Description:
Else,
->collection('binary')
could fails in some cases, because of the generated code is something likeaddressable_type varchar(255) collate binary not null
(the correct isaddressable_type varchar(255) collate "binary" not null
).I think that it should be applied to both: collaction and charset.It affects MariaDB 10.1, but I don't know if it affects other DBMS and which versions.
I am not the best person to PR that, so if someone could do that, it will be very useful.
Steps to reproduce
Full test case:
Code generated:
Code manually fixed:
The text was updated successfully, but these errors were encountered: