提交 9df30839 编写于 作者: S Sean Griffin

Merge pull request #23458 from kamipo/activerecord_supports_mysql_5.0_and_up

Active Record supports MySQL >= 5.0
......@@ -52,7 +52,6 @@ def schema_creation
INDEX_TYPES = [:fulltext, :spatial]
INDEX_USINGS = [:btree, :hash]
# FIXME: Make the first parameter more similar for the two adapters
def initialize(connection, logger, connection_options, config)
super(connection, logger, config)
@quoted_column_names, @quoted_table_names = {}, {}
......@@ -65,6 +64,10 @@ def initialize(connection, logger, connection_options, config)
else
@prepared_statements = false
end
if version < '5.0.0'
raise "Your version of MySQL (#{full_version.match(/^\d+\.\d+\.\d+/)[0]}) is too old. Active Record supports MySQL >= 5.0."
end
end
CHARSETS_OF_4BYTES_MAXLEN = ['utf8mb4', 'utf16', 'utf16le', 'utf32']
......@@ -98,12 +101,8 @@ def supports_index_sort_order?
true
end
# MySQL 4 technically support transaction isolation, but it is affected by a bug
# where the transaction level gets persisted for the whole session:
#
# http://bugs.mysql.com/bug.php?id=39170
def supports_transaction_isolation?
version >= '5.0.0'
true
end
def supports_explain?
......@@ -119,17 +118,15 @@ def supports_foreign_keys?
end
def supports_views?
version >= '5.0.0'
true
end
def supports_datetime_with_precision?
version >= '5.6.4'
end
# 5.0.0 definitely supports it, possibly supported by earlier versions but
# not sure
def supports_advisory_locks?
version >= '5.0.0'
true
end
def get_advisory_lock(lock_name, timeout = 0) # :nodoc:
......
......@@ -201,8 +201,7 @@ def test_mysql_integer_not_null_defaults
assert_equal '0', klass.columns_hash['zero'].default
assert !klass.columns_hash['zero'].null
# 0 in MySQL 4, nil in 5.
assert [0, nil].include?(klass.columns_hash['omit'].default)
assert_equal nil, klass.columns_hash['omit'].default
assert !klass.columns_hash['omit'].null
assert_raise(ActiveRecord::StatementInvalid) { klass.create! }
......
# MySQL. Versions 4.1 and 5.0 are recommended.
# MySQL. Versions 5.0 and up are supported.
#
# Install the MySQL driver:
# gem install activerecord-jdbcmysql-adapter
......
# MySQL. Versions 5.0+ are recommended.
# MySQL. Versions 5.0 and up are supported.
#
# Install the MySQL driver
# gem install mysql2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册