diff --git a/.travis.yml b/.travis.yml index 4fc3543..0dab898 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ env: - DB=sqlite3 - DB=mysql - DB=postgresql + - DB=jdbc-mysql matrix: allow_failures: diff --git a/lib/activeuuid/patches.rb b/lib/activeuuid/patches.rb index 1a28db4..f154092 100644 --- a/lib/activeuuid/patches.rb +++ b/lib/activeuuid/patches.rb @@ -14,6 +14,19 @@ def uuid(*column_names) end end + module JdbcMySQLSimplifiedType + extend ActiveSupport::Concern + + included do + def simplified_type_with_mysqljdbc(field_type) + return :uuid if field_type == 'binary(16)' + simplified_type_without_mysqljdbc(field_type) + end + + alias_method_chain :simplified_type, :mysqljdbc + end + end + module Column extend ActiveSupport::Concern @@ -118,6 +131,12 @@ def self.apply! ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :include, PostgreSQLQuoting if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter + + if defined? ActiveRecord::ConnectionAdapters::MysqlAdapter + ActiveRecord::ConnectionAdapters::MysqlAdapter.send :include, Quoting + ActiveRecord::ConnectionAdapters::MysqlAdapter::Column.send :include, Column + ArJdbc::MySQL::Column.send :include, JdbcMySQLSimplifiedType + end end end end