Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
2c845f6b
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,体验更适合开发者的 AI 搜索 >>
提交
2c845f6b
编写于
10月 24, 2017
作者:
R
Rafael França
提交者:
GitHub
10月 24, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #30976 from yahonda/supports_extensions_always_true
`supports_extensions?` return always true since PostgreSQL 9.1
上级
9a55eb05
5cd6f179
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
466 addition
and
488 deletion
+466
-488
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
...b/active_record/connection_adapters/postgresql_adapter.rb
+3
-9
activerecord/test/cases/adapters/postgresql/citext_test.rb
activerecord/test/cases/adapters/postgresql/citext_test.rb
+54
-56
activerecord/test/cases/adapters/postgresql/extension_migration_test.rb
...est/cases/adapters/postgresql/extension_migration_test.rb
+0
-4
activerecord/test/cases/adapters/postgresql/hstore_test.rb
activerecord/test/cases/adapters/postgresql/hstore_test.rb
+294
-296
activerecord/test/cases/adapters/postgresql/uuid_test.rb
activerecord/test/cases/adapters/postgresql/uuid_test.rb
+92
-98
activerecord/test/cases/schema_dumper_test.rb
activerecord/test/cases/schema_dumper_test.rb
+23
-25
未找到文件。
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
浏览文件 @
2c845f6b
...
...
@@ -337,18 +337,12 @@ def disable_extension(name)
end
def
extension_enabled?
(
name
)
if
supports_extensions?
res
=
exec_query
(
"SELECT EXISTS(SELECT * FROM pg_available_extensions WHERE name = '
#{
name
}
' AND installed_version IS NOT NULL) as enabled"
,
"SCHEMA"
)
res
.
cast_values
.
first
end
end
def
extensions
if
supports_extensions?
exec_query
(
"SELECT extname FROM pg_extension"
,
"SCHEMA"
).
cast_values
else
super
end
end
# Returns the configured supported identifier length supported by PostgreSQL
...
...
activerecord/test/cases/adapters/postgresql/citext_test.rb
浏览文件 @
2c845f6b
...
...
@@ -3,8 +3,7 @@
require
"cases/helper"
require
"support/schema_dumping_helper"
if
ActiveRecord
::
Base
.
connection
.
supports_extensions?
class
PostgresqlCitextTest
<
ActiveRecord
::
PostgreSQLTestCase
class
PostgresqlCitextTest
<
ActiveRecord
::
PostgreSQLTestCase
include
SchemaDumpingHelper
class
Citext
<
ActiveRecord
::
Base
self
.
table_name
=
"citexts"
...
...
@@ -76,5 +75,4 @@ def test_schema_dump_with_shorthand
output
=
dump_table_schema
(
"citexts"
)
assert_match
%r[t
\.
citext "cival"]
,
output
end
end
end
activerecord/test/cases/adapters/postgresql/extension_migration_test.rb
浏览文件 @
2c845f6b
...
...
@@ -22,10 +22,6 @@ def setup
@connection
=
ActiveRecord
::
Base
.
connection
unless
@connection
.
supports_extensions?
return
skip
(
"no extension support"
)
end
@old_schema_migration_table_name
=
ActiveRecord
::
SchemaMigration
.
table_name
@old_table_name_prefix
=
ActiveRecord
::
Base
.
table_name_prefix
@old_table_name_suffix
=
ActiveRecord
::
Base
.
table_name_suffix
...
...
activerecord/test/cases/adapters/postgresql/hstore_test.rb
浏览文件 @
2c845f6b
...
...
@@ -3,8 +3,7 @@
require
"cases/helper"
require
"support/schema_dumping_helper"
if
ActiveRecord
::
Base
.
connection
.
supports_extensions?
class
PostgresqlHstoreTest
<
ActiveRecord
::
PostgreSQLTestCase
class
PostgresqlHstoreTest
<
ActiveRecord
::
PostgreSQLTestCase
include
SchemaDumpingHelper
class
Hstore
<
ActiveRecord
::
Base
self
.
table_name
=
"hstores"
...
...
@@ -376,5 +375,4 @@ def assert_cycle(hash)
x
.
reload
assert_equal
(
hash
,
x
.
tags
)
end
end
end
activerecord/test/cases/adapters/postgresql/uuid_test.rb
浏览文件 @
2c845f6b
...
...
@@ -222,7 +222,6 @@ class UUID < ActiveRecord::Base
connection
.
execute
"DROP FUNCTION IF EXISTS my_uuid_generator();"
end
if
ActiveRecord
::
Base
.
connection
.
supports_extensions?
def
test_id_is_uuid
assert_equal
:uuid
,
UUID
.
columns_hash
[
"id"
].
type
assert
UUID
.
primary_key
...
...
@@ -284,7 +283,6 @@ def migrate(x)
drop_table
"pg_uuids_4"
ActiveRecord
::
Migration
.
verbose
=
@verbose_was
end
end
end
class
PostgresqlUUIDTestNilDefault
<
ActiveRecord
::
PostgreSQLTestCase
...
...
@@ -302,7 +300,6 @@ class PostgresqlUUIDTestNilDefault < ActiveRecord::PostgreSQLTestCase
drop_table
"pg_uuids"
end
if
ActiveRecord
::
Base
.
connection
.
supports_extensions?
def
test_id_allows_default_override_via_nil
col_desc
=
connection
.
execute
(
"SELECT pg_get_expr(d.adbin, d.adrelid) as default
FROM pg_attribute a
...
...
@@ -334,7 +331,6 @@ def migrate(x)
drop_table
"pg_uuids_4"
ActiveRecord
::
Migration
.
verbose
=
@verbose_was
end
end
end
class
PostgresqlUUIDTestInverseOf
<
ActiveRecord
::
PostgreSQLTestCase
...
...
@@ -367,7 +363,6 @@ class UuidComment < ActiveRecord::Base
drop_table
"pg_uuid_posts"
end
if
ActiveRecord
::
Base
.
connection
.
supports_extensions?
def
test_collection_association_with_uuid
post
=
UuidPost
.
create!
comment
=
post
.
uuid_comments
.
create!
...
...
@@ -385,5 +380,4 @@ def test_find_by_with_uuid
UuidPost
.
create!
assert_nil
UuidPost
.
find_by
(
id:
789
)
end
end
end
activerecord/test/cases/schema_dumper_test.rb
浏览文件 @
2c845f6b
...
...
@@ -294,7 +294,6 @@ def test_schema_dump_oid_type
assert_match
%r{t
\.
oid
\s
+"obj_id"$}
,
output
end
if
ActiveRecord
::
Base
.
connection
.
supports_extensions?
def
test_schema_dump_includes_extensions
connection
=
ActiveRecord
::
Base
.
connection
...
...
@@ -323,7 +322,6 @@ def test_schema_dump_includes_extensions_in_alphabetic_order
assert_equal
[
"hstore"
,
"uuid-ossp"
,
"xml2"
],
enabled_extensions
end
end
end
def
test_schema_dump_keeps_large_precision_integer_columns_as_decimal
output
=
standard_dump
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录