未验证 提交 e53acfde 编写于 作者: A Aaron Patterson 提交者: GitHub

Merge pull request #34227 from bkuhlmann/master-lazy_mysql_version_check_support

Refactored abstract MySQL adapter to support lazy version check.
......@@ -26,6 +26,7 @@ class AbstractMysqlAdapter < AbstractAdapter
# ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans = false
class_attribute :emulate_booleans, default: true
SUPPORTED_VERSION = "5.5.8"
NATIVE_DATABASE_TYPES = {
primary_key: "bigint auto_increment PRIMARY KEY",
string: { name: "varchar", limit: 255 },
......@@ -54,10 +55,7 @@ def initialize(connection, logger, connection_options, config)
super(connection, logger, config)
@statements = StatementPool.new(self.class.type_cast_config_to_integer(config[:statement_limit]))
if version < "5.5.8"
raise "Your version of MySQL (#{version_string}) is too old. Active Record supports MySQL >= 5.5.8."
end
check_version
end
def version #:nodoc:
......@@ -534,6 +532,15 @@ def insert_fixtures_set(fixture_set, tables_to_delete = [])
end
end
protected
def check_version
if version < SUPPORTED_VERSION
raise "Your version of MySQL (#{version_string}) is too old. Active Record supports " \
"MySQL >= #{SUPPORTED_VERSION}."
end
end
private
def combine_multi_statements(total_sql)
total_sql.each_with_object([]) do |sql, total_sql_chunks|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册