Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
9df30839
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9df30839
编写于
2月 03, 2016
作者:
S
Sean Griffin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #23458 from kamipo/activerecord_supports_mysql_5.0_and_up
Active Record supports MySQL >= 5.0
上级
8ee91d40
c7f8019b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
14 deletion
+10
-14
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
...tive_record/connection_adapters/abstract_mysql_adapter.rb
+7
-10
activerecord/test/cases/defaults_test.rb
activerecord/test/cases/defaults_test.rb
+1
-2
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml
...rators/rails/app/templates/config/databases/jdbcmysql.yml
+1
-1
railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml
...generators/rails/app/templates/config/databases/mysql.yml
+1
-1
未找到文件。
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
浏览文件 @
9df30839
...
...
@@ -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:
...
...
activerecord/test/cases/defaults_test.rb
浏览文件 @
9df30839
...
...
@@ -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!
}
...
...
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml
浏览文件 @
9df30839
# MySQL.
Versions 4.1 and 5.0 are recommend
ed.
# MySQL.
Versions 5.0 and up are support
ed.
#
# Install the MySQL driver:
# gem install activerecord-jdbcmysql-adapter
...
...
railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml
浏览文件 @
9df30839
# MySQL.
Versions 5.0+ are recommend
ed.
# MySQL.
Versions 5.0 and up are support
ed.
#
# Install the MySQL driver
# gem install mysql2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录