[DRE-commits] [redmine] 03/05: Force table encoding in mysql
Antonio Terceiro
terceiro at moszumanska.debian.org
Fri Jan 22 13:01:26 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch patch-queue/master
in repository redmine.
commit 53067f0e34339d5fc7b39aa19bf19590e9023826
Author: Jérémy Lal <kapouer at melix.org>
Date: Sat Sep 19 17:42:05 2015 -0300
Force table encoding in mysql
mysql default encoding is not UTF8, but forcing table encoding is
possible. dbconfig-common does not provide appropriate configuration
variable, so here the mysql adapter is modified to respect encoding set
in database.yml Forwarded: not-needed
Gbp-Pq: Name 0002-Force-table-encoding-in-mysql.patch
---
config/initializers/10-patches.rb | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb
index dae04fc..7837223 100644
--- a/config/initializers/10-patches.rb
+++ b/config/initializers/10-patches.rb
@@ -1,4 +1,19 @@
require 'active_record'
+require 'active_record/connection_adapters/abstract_mysql_adapter'
+
+module ActiveRecord
+ module ConnectionAdapters
+ class MysqlAdapter < AbstractMysqlAdapter
+ def create_table(table_name, options = {}) #:nodoc:
+ encoding = @config[:encoding]
+ if encoding
+ options = options.reverse_merge(:options => "DEFAULT CHARSET=#{encoding}")
+ end
+ super(table_name, options.reverse_merge(:options => "ENGINE=InnoDB"))
+ end
+ end
+ end
+end
module ActiveRecord
class Base
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/redmine.git
More information about the Pkg-ruby-extras-commits
mailing list