Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c7e192c7
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,发现更多精彩内容 >>
提交
c7e192c7
编写于
12月 02, 2014
作者:
Y
Yves Senn
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17576 from senny/native_database_types
no need to pass native_database_types around
上级
780269c7
9e4ed2f9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
7 deletion
+13
-7
activerecord/CHANGELOG.md
activerecord/CHANGELOG.md
+7
-0
activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb
...tive_record/connection_adapters/abstract/schema_dumper.rb
+4
-4
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
...b/active_record/connection_adapters/postgresql_adapter.rb
+1
-1
activerecord/lib/active_record/schema_dumper.rb
activerecord/lib/active_record/schema_dumper.rb
+1
-2
未找到文件。
activerecord/CHANGELOG.md
浏览文件 @
c7e192c7
*
`ActiveRecord::ConnectionAdapters::ColumnDumper#column_spec`
and
`ActiveRecord::ConnectionAdapters::ColumnDumper#prepare_column_options`
no
longer have a
`types`
argument. They should access
`connection#native_database_types`
directly.
*Yves Senn*
Please check
[
4-2-stable
](
https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md
)
for previous changes.
activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb
浏览文件 @
c7e192c7
...
...
@@ -6,8 +6,8 @@ module ConnectionAdapters # :nodoc:
# We can then redefine how certain data types may be handled in the schema dumper on the
# Adapter level by over-writing this code inside the database specific adapters
module
ColumnDumper
def
column_spec
(
column
,
types
)
spec
=
prepare_column_options
(
column
,
types
)
def
column_spec
(
column
)
spec
=
prepare_column_options
(
column
)
(
spec
.
keys
-
[
:name
,
:type
]).
each
{
|
k
|
spec
[
k
].
insert
(
0
,
"
#{
k
}
: "
)}
spec
end
...
...
@@ -15,13 +15,13 @@ def column_spec(column, types)
# This can be overridden on a Adapter level basis to support other
# extended datatypes (Example: Adding an array option in the
# PostgreSQLAdapter)
def
prepare_column_options
(
column
,
types
)
def
prepare_column_options
(
column
)
spec
=
{}
spec
[
:name
]
=
column
.
name
.
inspect
spec
[
:type
]
=
column
.
type
.
to_s
spec
[
:null
]
=
'false'
unless
column
.
null
limit
=
column
.
limit
||
types
[
column
.
type
][
:limit
]
limit
=
column
.
limit
||
native_database_
types
[
column
.
type
][
:limit
]
spec
[
:limit
]
=
limit
.
inspect
if
limit
spec
[
:precision
]
=
column
.
precision
.
inspect
if
column
.
precision
spec
[
:scale
]
=
column
.
scale
.
inspect
if
column
.
scale
...
...
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
浏览文件 @
c7e192c7
...
...
@@ -127,7 +127,7 @@ def schema_creation # :nodoc:
# Adds +:array+ option to the default set provided by the
# AbstractAdapter
def
prepare_column_options
(
column
,
types
)
# :nodoc:
def
prepare_column_options
(
column
)
# :nodoc:
spec
=
super
spec
[
:array
]
=
'true'
if
column
.
respond_to?
(
:array
)
&&
column
.
array
spec
[
:default
]
=
"
\"
#{
column
.
default_function
}
\"
"
if
column
.
default_function
...
...
activerecord/lib/active_record/schema_dumper.rb
浏览文件 @
c7e192c7
...
...
@@ -44,7 +44,6 @@ def dump(stream)
def
initialize
(
connection
,
options
=
{})
@connection
=
connection
@types
=
@connection
.
native_database_types
@version
=
Migrator
::
current_version
rescue
nil
@options
=
options
end
...
...
@@ -134,7 +133,7 @@ def table(table, stream)
column_specs
=
columns
.
map
do
|
column
|
raise
StandardError
,
"Unknown type '
#{
column
.
sql_type
}
' for column '
#{
column
.
name
}
'"
unless
@connection
.
valid_type?
(
column
.
type
)
next
if
column
.
name
==
pk
@connection
.
column_spec
(
column
,
@types
)
@connection
.
column_spec
(
column
)
end
.
compact
# find all migration keys used in this table
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录