Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
b2a25948
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,发现更多精彩内容 >>
提交
b2a25948
编写于
8月 26, 2015
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21336 from yui-knk/refactor/to_use_getter
Use `ActiveRecord::Migration#connection` instead of `@connection`
上级
e47e8e91
1591c345
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
7 addition
and
7 deletion
+7
-7
activerecord/lib/active_record/migration.rb
activerecord/lib/active_record/migration.rb
+7
-7
未找到文件。
activerecord/lib/active_record/migration.rb
浏览文件 @
b2a25948
...
...
@@ -475,13 +475,13 @@ def initialize(name = self.class.name, version = nil)
def
revert
(
*
migration_classes
)
run
(
*
migration_classes
.
reverse
,
revert:
true
)
unless
migration_classes
.
empty?
if
block_given?
if
@
connection
.
respond_to?
:revert
@
connection
.
revert
{
yield
}
if
connection
.
respond_to?
:revert
connection
.
revert
{
yield
}
else
recorder
=
CommandRecorder
.
new
(
@
connection
)
recorder
=
CommandRecorder
.
new
(
connection
)
@connection
=
recorder
suppress_messages
do
@
connection
.
revert
{
yield
}
connection
.
revert
{
yield
}
end
@connection
=
recorder
.
delegate
recorder
.
commands
.
each
do
|
cmd
,
args
,
block
|
...
...
@@ -492,7 +492,7 @@ def revert(*migration_classes)
end
def
reverting?
@connection
.
respond_to?
(
:reverting
)
&&
@
connection
.
reverting
connection
.
respond_to?
(
:reverting
)
&&
connection
.
reverting
end
class
ReversibleBlockHelper
<
Struct
.
new
(
:reverting
)
# :nodoc:
...
...
@@ -549,7 +549,7 @@ def run(*migration_classes)
revert
{
run
(
*
migration_classes
,
direction:
dir
,
revert:
true
)
}
else
migration_classes
.
each
do
|
migration_class
|
migration_class
.
new
.
exec_migration
(
@
connection
,
dir
)
migration_class
.
new
.
exec_migration
(
connection
,
dir
)
end
end
end
...
...
@@ -641,7 +641,7 @@ def method_missing(method, *arguments, &block)
arg_list
=
arguments
.
map
(
&
:inspect
)
*
', '
say_with_time
"
#{
method
}
(
#{
arg_list
}
)"
do
unless
@
connection
.
respond_to?
:revert
unless
connection
.
respond_to?
:revert
unless
arguments
.
empty?
||
[
:execute
,
:enable_extension
,
:disable_extension
].
include?
(
method
)
arguments
[
0
]
=
proper_table_name
(
arguments
.
first
,
table_name_options
)
if
[
:rename_table
,
:add_foreign_key
].
include?
(
method
)
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录