fix: support mariadb in sync:daily-change (#64)
* fix: support mariadb in sync:daily-change * use version() instead of system variables --------- Co-authored-by: hackerESQ <corey@coreyvarma.com>
This commit is contained in:
+14
-1
@@ -7,6 +7,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Holding extends Model
|
||||
@@ -253,7 +254,19 @@ class Holding extends Model
|
||||
$date_interval = "date(date, '+1 day')";
|
||||
} else {
|
||||
|
||||
DB::statement('SET cte_max_recursion_depth=1000000;');
|
||||
// MySQL default
|
||||
$max_recursion_var_name = 'cte_max_recursion_depth';
|
||||
|
||||
// Determine if running MySQL or MariaDB
|
||||
$versionString = Arr::get(
|
||||
DB::select('SELECT VERSION() as version;'),
|
||||
'0.version', ''
|
||||
);
|
||||
if (stripos($versionString, 'MariaDB') !== false) {
|
||||
$max_recursion_var_name = 'max_recursive_iterations'; // Must be MariaDB
|
||||
}
|
||||
|
||||
DB::statement("SET $max_recursion_var_name=1000000;");
|
||||
}
|
||||
|
||||
return DB::table(DB::raw("(
|
||||
|
||||
Reference in New Issue
Block a user