提交 1a7be948 编写于 作者: R Ryuta Kamizono

Remove useless rescue in `setup` for PostgreSQL adapter tests

All types are supported for PostgreSQL >= 9.3.
上级 82d0061e
......@@ -14,13 +14,9 @@ def setup
enable_extension!("ltree", @connection)
@connection.transaction do
@connection.create_table("ltrees") do |t|
t.ltree "path"
end
@connection.create_table("ltrees") do |t|
t.ltree "path"
end
rescue ActiveRecord::StatementInvalid
skip "do not test on PG without ltree"
end
teardown do
......
......@@ -15,35 +15,31 @@ class PostgresqlRangeTest < ActiveRecord::PostgreSQLTestCase
def setup
@connection = PostgresqlRange.connection
begin
@connection.transaction do
@connection.execute <<~SQL
CREATE TYPE floatrange AS RANGE (
subtype = float8,
subtype_diff = float8mi
);
CREATE TYPE stringrange AS RANGE (
subtype = varchar
);
SQL
@connection.create_table("postgresql_ranges") do |t|
t.daterange :date_range
t.numrange :num_range
t.tsrange :ts_range
t.tstzrange :tstz_range
t.int4range :int4_range
t.int8range :int8_range
end
@connection.add_column "postgresql_ranges", "float_range", "floatrange"
@connection.add_column "postgresql_ranges", "string_range", "stringrange"
@connection.transaction do
@connection.execute <<~SQL
CREATE TYPE floatrange AS RANGE (
subtype = float8,
subtype_diff = float8mi
);
CREATE TYPE stringrange AS RANGE (
subtype = varchar
);
SQL
@connection.create_table("postgresql_ranges") do |t|
t.daterange :date_range
t.numrange :num_range
t.tsrange :ts_range
t.tstzrange :tstz_range
t.int4range :int4_range
t.int8range :int8_range
end
PostgresqlRange.reset_column_information
rescue ActiveRecord::StatementInvalid
skip "do not test on PG without range"
@connection.add_column "postgresql_ranges", "float_range", "floatrange"
@connection.add_column "postgresql_ranges", "string_range", "stringrange"
end
PostgresqlRange.reset_column_information
insert_range(id: 101,
date_range: "[''2012-01-02'', ''2012-01-04'']",
......
......@@ -11,14 +11,8 @@ class XmlDataType < ActiveRecord::Base
def setup
@connection = ActiveRecord::Base.connection
begin
@connection.transaction do
@connection.create_table("xml_data_type") do |t|
t.xml "payload"
end
end
rescue ActiveRecord::StatementInvalid
skip "do not test on PG without xml"
@connection.create_table("xml_data_type") do |t|
t.xml "payload"
end
@column = XmlDataType.columns_hash["payload"]
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册