diff --git a/application/migrations/270_fix_dbcollate_again.php b/application/migrations/270_fix_dbcollate_again.php index e0140aa96..40bed9777 100644 --- a/application/migrations/270_fix_dbcollate_again.php +++ b/application/migrations/270_fix_dbcollate_again.php @@ -14,14 +14,22 @@ class Migration_fix_dbcollate_again extends CI_Migration 'vuccgrids' ); foreach ($tables as $table) { - $this->db->query('ALTER TABLE ' . $table . ' CONVERT TO CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix existing tables that haven't already been fixed + $this->dbtry('ALTER TABLE ' . $table . ' CONVERT TO CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix existing tables that haven't already been fixed } - $this->db->query('ALTER DATABASE `' . $this->db->database . '` CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix the database default + $this->dbtry('ALTER DATABASE `' . $this->db->database . '` CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix the database default } public function down() { // Not Possible } + + function dbtry($what) { + try { + $this->db->query($what); + } catch (Exception $e) { + log_message("error", "Error setting character set/collation: ".$e." // Executing: ".$this->db->last_query()); + } + } } ?> \ No newline at end of file