diff --git a/app/Database/migrations/2024_07_09_210356_update_db_charset.php b/app/Database/migrations/2024_07_09_210356_update_db_charset.php index 9d1918358..33df77f35 100644 --- a/app/Database/migrations/2024_07_09_210356_update_db_charset.php +++ b/app/Database/migrations/2024_07_09_210356_update_db_charset.php @@ -17,11 +17,12 @@ public function up() } // Check the current charset - $connection = DB::connection()->getPdo(); - $statement = $connection->query("SHOW VARIABLES LIKE 'character_set_connection'"); - $result = $statement->fetch(PDO::FETCH_ASSOC); + $query = DB::table('information_schema.SCHEMATA') + ->select('default_character_set_name') + ->where('schema_name', config('database.connections.mysql.database')) + ->first(); - if ($result['Value'] === 'utf8mb4') { + if ($query?->default_character_set_name === 'utf8mb4') { return; }