Cleanup SQL CHARSET and COLLATE

* Set same charset and collate for all tables
* Recommends collate utf8mb4_0900_ai_ci which is MySQL default
这个提交包含在:
Ondřej Nový 2022-01-20 22:53:55 +01:00
父节点 e086dc4070
当前提交 216aaff844
共有 3 个文件被更改,包括 43 次插入3 次删除

查看文件

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

查看文件

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

查看文件

@ -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
}
}