Cleanup SQL CHARSET and COLLATE

* Set same charset and collate for all tables
* Recommends collate utf8mb4_0900_ai_ci which is MySQL default
pull/1382/head
Ondřej Nový 2022-01-20 22:53:55 +01:00
rodzic e086dc4070
commit 216aaff844
3 zmienionych plików z 43 dodań i 3 usunięć

Wyświetl plik

@ -88,7 +88,7 @@ $db['default'] = array(
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8mb4',
'dbcollat' => 'utf8mb4_general_ci',
'dbcollat' => 'utf8mb4_0900_ai_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,

Wyświetl plik

@ -21,8 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 83;
$config['migration_version'] = 84;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -0,0 +1,41 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_fix_collate extends CI_Migration
{
public function up()
{
$tables = array(
$this->config->item('table_name'),
'adif_modes',
'api',
'cat',
'config',
'contest',
'dxcc_entities',
'dxcc_exceptions',
'dxcc_prefixes',
'eQSL_images',
'iota',
'lotw_certs',
'migrations',
'notes',
'options',
'qsl_images',
'queries',
'station_logbooks',
'station_logbooks_relationship',
'station_profile',
'timezones',
'users'
);
foreach ($tables as $table) {
$this->db->query('ALTER TABLE ' . $table . ' CONVERT TO CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat);
}
}
public function down()
{
// Not Possible
}
}