![]() ![]() $test = DB::select(DB::raw("select * from INFORMATION_SCHEMA.COLUMNS where DATA_TYPE = 'varchar' AND TABLE_SCHEMA = '$dbName' ")) $result = DB::select(DB::raw('show tables')) $dbName = Config::get('nnections.'.Config::get('fault').'.database') \DB::connection($connection)->getPdo()->exec($query) įor anyone willing to achieve this on the whole database i found myself needing such a script : getPdo()->exec($query) Private function dbExec($query, $dryRun, $connection) Private function convertDb($connection, $charset, $collate, $dryRun) $this->convertDb('mysql', 'utf8', 'utf8_unicode_ci', $dryRun) $this->convertDb('archive', 'utf8', 'utf8_unicode_ci', $dryRun) $this->convertDb('archive', 'utf8mb4', 'utf8mb4_unicode_ci', $dryRun) $this->convertDb('mysql', 'utf8mb4', 'utf8mb4_unicode_ci', $dryRun) This also handles all text types and batches all conversions for each table into a single statement for speed.ĭryrun flag outputs usable sql instead of applying directly. If a column will be shrunk, it then checks if any data will be truncated. Otherwise, they are converted, but size is left as is. If the above is possible, am I better off setting utf8mb4 for all tables or only use that for the 2 table columns where I will really be using emoji.īased on answer, but will only shrink varchar when they exceed limits AND are used in an index. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |