summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/config/example/database.php6
-rw-r--r--application/config/migration.php2
-rw-r--r--application/migrations/021_change_charset.php27
3 files changed, 31 insertions, 4 deletions
diff --git a/application/config/example/database.php b/application/config/example/database.php
index b4cb64039..6b71bf60b 100644
--- a/application/config/example/database.php
+++ b/application/config/example/database.php
@@ -86,12 +86,12 @@ $db['default'] = array(
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
- 'char_set' => 'utf8',
- 'dbcollat' => 'utf8_general_ci',
+ 'char_set' => 'utf8mb4',
+ 'dbcollat' => 'utf8mb4_bin',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
- 'stricton' => FALSE,
+ 'stricton' => TRUE,
'failover' => array(),
'save_queries' => TRUE
);
diff --git a/application/config/migration.php b/application/config/migration.php
index 621a0eeb6..ffddae2ac 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -69,7 +69,7 @@ $config['migration_auto_latest'] = FALSE;
| be upgraded / downgraded to.
|
*/
-$config['migration_version'] = 20;
+$config['migration_version'] = 21;
/*
|--------------------------------------------------------------------------
diff --git a/application/migrations/021_change_charset.php b/application/migrations/021_change_charset.php
new file mode 100644
index 000000000..20a8ce7f7
--- /dev/null
+++ b/application/migrations/021_change_charset.php
@@ -0,0 +1,27 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Migration_change_charset extends CI_Migration {
+
+ public function up()
+ {
+ $prefix = $this->db->dbprefix;
+
+ if ($this->db->dbdriver == 'postgre') {
+ # nothing to do
+ } else {
+ $this->db->query('SET FOREIGN_KEY_CHECKS = 0');
+ foreach (['actions', 'apikeys', 'files', 'file_storage', 'multipaste', 'multipaste_file_map', 'profiles', 'users'] as $table) {
+ $this->db->query('
+ ALTER TABLE `'.$prefix.$table.'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+ ');
+ }
+ $this->db->query('SET FOREIGN_KEY_CHECKS = 1');
+ }
+ }
+
+ public function down()
+ {
+ throw new \exceptions\ApiException("migration/downgrade-not-supported", "downgrade not supported");
+ }
+}