From 38e1ee13536132fffc814d353ab04ec51ec102f6 Mon Sep 17 00:00:00 2001 From: Juup Schram Date: Thu, 27 Jun 2019 22:59:36 +0200 Subject: [PATCH 1/2] Make sure changing a database field to binary does not include collation This PR will fix an issue very close to https://github.com/laravel/framework/issues/25735#issuecomment-423773584. It will fix pretty much the same error but then when changing a text field in to a binary. --- src/Illuminate/Database/Schema/Grammars/ChangeColumn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php b/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php index d449dfc71ff0..8678fa10a134 100644 --- a/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php +++ b/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php @@ -121,7 +121,7 @@ protected static function getDoctrineColumnChangeOptions(Fluent $fluent) $options['length'] = static::calculateDoctrineTextLength($fluent['type']); } - if ($fluent['type'] === 'json') { + if ($fluent['type'] === 'json' || $fluent['type'] === 'binary') { $options['customSchemaOptions'] = [ 'collation' => '', ]; From 5e57e5b454bb5b623a586d409a63e9327110fa73 Mon Sep 17 00:00:00 2001 From: Juup Schram Date: Fri, 28 Jun 2019 08:45:53 +0200 Subject: [PATCH 2/2] Use in_array instead of || operator --- src/Illuminate/Database/Schema/Grammars/ChangeColumn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php b/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php index 8678fa10a134..8fc3b8c8a2c3 100644 --- a/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php +++ b/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php @@ -121,7 +121,7 @@ protected static function getDoctrineColumnChangeOptions(Fluent $fluent) $options['length'] = static::calculateDoctrineTextLength($fluent['type']); } - if ($fluent['type'] === 'json' || $fluent['type'] === 'binary') { + if (in_array($fluent['type'], ['json', 'binary'])) { $options['customSchemaOptions'] = [ 'collation' => '', ];