@@ -49,7 +49,7 @@ public static function getPartitionNames($db, $table)
4949 . " WHERE `TABLE_SCHEMA` = ' " . $ db
5050 . "' AND `TABLE_NAME` = ' " . $ table . "' " ;
5151 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
52- return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
52+ return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
5353 } else {
5454 return DB ::select (DB ::raw ($ query ));
5555 }
@@ -129,7 +129,7 @@ public static function partitionByMonths($table, $column, $schema = null)
129129 $ query .= "PARTITION `dec` VALUES LESS THAN (13) " ;
130130 $ query .= ") " ;
131131 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
132- DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
132+ DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
133133 } else {
134134 DB ::unprepared (DB ::raw ($ query )->getValue ());
135135 }
@@ -246,7 +246,7 @@ public static function partitionByList($table, $column, $partitions, $schema = n
246246 $ query .= self ::implodePartitions ($ partitions );
247247 $ query .= ') ' ;
248248 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
249- DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
249+ DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
250250 } else {
251251 DB ::unprepared (DB ::raw ($ query ));
252252 }
@@ -268,7 +268,7 @@ public static function partitionByHash($table, $hashColumn, $partitionsNumber, $
268268 $ query = "ALTER TABLE {$ appendSchema }{$ table } PARTITION BY HASH( {$ hashColumn }) " ;
269269 $ query .= "PARTITIONS {$ partitionsNumber }; " ;
270270 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
271- DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
271+ DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
272272 } else {
273273 DB ::unprepared (DB ::raw ($ query ));
274274 }
@@ -289,7 +289,7 @@ public static function partitionByKey($table, $partitionsNumber, $schema = null)
289289 $ query = "ALTER TABLE {$ appendSchema }{$ table } PARTITION BY KEY() " ;
290290 $ query .= "PARTITIONS {$ partitionsNumber }; " ;
291291 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
292- DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
292+ DB ::unprepared (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
293293 } else {
294294 DB ::unprepared (DB ::raw ($ query ));
295295 }
@@ -360,7 +360,7 @@ public static function optimizePartitions($table, $partitions)
360360 {
361361 $ query = "ALTER TABLE {$ table } OPTIMIZE PARTITION " . implode (', ' , $ partitions );
362362 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
363- return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
363+ return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
364364 } else {
365365 return DB ::select (DB ::raw ($ query ));
366366 }
@@ -376,7 +376,7 @@ public static function analyzePartitions($table, $partitions)
376376 {
377377 $ query = "ALTER TABLE {$ table } ANALYZE PARTITION " . implode (', ' , $ partitions );
378378 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
379- return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
379+ return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
380380 } else {
381381 return DB ::select (DB ::raw ($ query ));
382382 }
@@ -394,7 +394,7 @@ public static function repairPartitions($table, $partitions)
394394 {
395395 $ query = "ALTER TABLE {$ table } REPAIR PARTITION " . implode (', ' , $ partitions );
396396 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
397- return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
397+ return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
398398 } else {
399399 return DB ::select (DB ::raw ($ query ));
400400 }
@@ -410,7 +410,7 @@ public static function checkPartitions($table, $partitions)
410410 {
411411 $ query = "ALTER TABLE {$ table } CHECK PARTITION " . implode (', ' , $ partitions );
412412 if (version_compare (static ::getAppVersion (),'10.0.0 ' ) >= 0 ) {
413- return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar ()));
413+ return DB ::select (DB ::raw ($ query )->getValue (new MySqlGrammar (DB :: connection () )));
414414 } else {
415415 return DB ::select (DB ::raw ($ query ));
416416 }
@@ -444,4 +444,4 @@ private static function getAppVersion(): string
444444 return '' ;
445445 }
446446 }
447- }
447+ }
0 commit comments