Skip to content
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

[5.6] Quote collation name in MySQL migrations #23989

Merged
merged 2 commits into from
Apr 25, 2018
Merged

[5.6] Quote collation name in MySQL migrations #23989

merged 2 commits into from
Apr 25, 2018

Conversation

staudenmeir
Copy link
Contributor

@staudenmeir staudenmeir commented Apr 24, 2018

Creating a column with a binary collation fails in MySQL:

Schema::create('table', function ($blueprint) {
    $blueprint->string('column')->collation('binary');
});

This executes the following SQL:

create table `table` (`column` varchar(255) collate binary not null)
    default character set utf8mb4 collate utf8mb4_unicode_ci

The query fails: Syntax error [...] the right syntax to use near 'binary not null) [...]

It works after quoting the collation name:

create table `table` (`column` varchar(255) collate 'binary' not null)
    default character set utf8mb4 collate 'utf8mb4_unicode_ci'

Fixes #23944.

@taylorotwell taylorotwell merged commit 6bf8c8a into laravel:5.6 Apr 25, 2018
@staudenmeir staudenmeir deleted the collation-mysql branch April 29, 2018 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants