Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
eabf0243
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,发现更多精彩内容 >>
未验证
提交
eabf0243
编写于
8月 19, 2016
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #26089 from travisoneill/sqlite_rollback_fix
Sqlite3 Migration Error Fixed (issue #26087)
上级
28aaf77b
906ff07e
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
31 addition
and
5 deletion
+31
-5
activerecord/CHANGELOG.md
activerecord/CHANGELOG.md
+11
-3
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
...record/connection_adapters/abstract/schema_definitions.rb
+1
-1
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
..._record/connection_adapters/abstract/schema_statements.rb
+2
-1
activerecord/test/cases/migration_test.rb
activerecord/test/cases/migration_test.rb
+17
-0
未找到文件。
activerecord/CHANGELOG.md
浏览文件 @
eabf0243
*
Sqlite3 migrations to add a column to an existing table can now be
successfully rolled back when the column was given and invalid column
type.
Fixes #26087
*Travis O'Neill*
*
Deprecate
`sanitize_conditions`
. Use
`sanitize_sql`
instead.
*Ryuta Kamizono*
...
...
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
浏览文件 @
eabf0243
...
...
@@ -303,7 +303,7 @@ def [](name)
# end
def
column
(
name
,
type
,
options
=
{})
name
=
name
.
to_s
type
=
type
.
to_sym
type
=
type
.
to_sym
if
type
options
=
options
.
dup
if
@columns_hash
[
name
]
&&
@columns_hash
[
name
].
primary_key?
...
...
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
浏览文件 @
eabf0243
...
...
@@ -1047,7 +1047,8 @@ def assume_migrated_upto_version(version, migrations_paths)
end
def
type_to_sql
(
type
,
limit
=
nil
,
precision
=
nil
,
scale
=
nil
)
#:nodoc:
if
native
=
native_database_types
[
type
.
to_sym
]
type
=
type
.
to_sym
if
type
if
native
=
native_database_types
[
type
]
column_type_sql
=
(
native
.
is_a?
(
Hash
)
?
native
[
:name
]
:
native
).
dup
if
type
==
:decimal
# ignore limit, use precision and scale
...
...
activerecord/test/cases/migration_test.rb
浏览文件 @
eabf0243
...
...
@@ -551,6 +551,23 @@ def test_create_table_with_query_from_relation
end
end
if
current_adapter?
(
:SQLite3Adapter
)
def
test_allows_sqlite3_rollback_on_invalid_column_type
Person
.
connection
.
create_table
:something
,
force:
true
do
|
t
|
t
.
column
:number
,
:integer
t
.
column
:name
,
:string
t
.
column
:foo
,
:bar
end
assert
Person
.
connection
.
column_exists?
(
:something
,
:foo
)
assert_nothing_raised
{
Person
.
connection
.
remove_column
:something
,
:foo
,
:bar
}
assert
!
Person
.
connection
.
column_exists?
(
:something
,
:foo
)
assert
Person
.
connection
.
column_exists?
(
:something
,
:name
)
assert
Person
.
connection
.
column_exists?
(
:something
,
:number
)
ensure
Person
.
connection
.
drop_table
:something
,
if_exists:
true
end
end
if
current_adapter?
:OracleAdapter
def
test_create_table_with_custom_sequence_name
# table name is 29 chars, the standard sequence name will
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录