@@ -167,19 +167,19 @@ private function genericCompileCreateIndex(Blueprint $blueprint, Fluent $command
167
167
168
168
$ index = [
169
169
$ unique ? 'create unique index ' : 'create index ' ,
170
- $ command ['concurrently ' ] ? 'concurrently ' : '' ,
171
- $ command ['ifNotExists ' ] ? 'if not exists ' : '' ,
170
+ $ command ['concurrently ' ] ? 'concurrently ' : null ,
171
+ $ command ['ifNotExists ' ] ? 'if not exists ' : null ,
172
172
$ this ->wrap ($ command ['index ' ]),
173
173
'on ' ,
174
174
$ this ->wrapTable ($ blueprint ),
175
- $ command ['algorithm ' ] ? "using {$ command ['algorithm ' ]}" : '' ,
175
+ $ command ['algorithm ' ] ? "using {$ command ['algorithm ' ]}" : null ,
176
176
'( ' .implode (', ' , $ columns ).') ' ,
177
- $ command ['include ' ] ? 'include ( ' .implode (', ' , $ this ->wrapArray (Arr::wrap ($ command ['include ' ]))).') ' : '' ,
178
- $ command ['nullsNotDistinct ' ] ? 'nulls not distinct ' : '' ,
179
- $ command ['with ' ] ? "with ( {$ command ['with ' ]}) " : '' ,
180
- $ command ['where ' ] ? "where {$ command ['where ' ]}" : '' ,
177
+ $ command ['include ' ] ? 'include ( ' .implode (', ' , $ this ->wrapArray (Arr::wrap ($ command ['include ' ]))).') ' : null ,
178
+ $ command ['nullsNotDistinct ' ] ? 'nulls not distinct ' : null ,
179
+ $ command ['with ' ] ? "with ( {$ command ['with ' ]}) " : null ,
180
+ $ command ['where ' ] ? "where {$ command ['where ' ]}" : null ,
181
181
];
182
- $ sql = implode (' ' , array_filter ($ index , fn ($ part ) => $ part ));
182
+ $ sql = implode (' ' , array_filter ($ index , fn (? string $ part ) => filled ( $ part) ));
183
183
184
184
return $ sql ;
185
185
}
0 commit comments