aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/schema_dumper_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-02-13 02:34:52 +0900
committerJeremy Daer <jeremydaer@gmail.com>2017-02-12 19:52:58 -0700
commit42ed16a987c91dcb1705a414b5da15c5275e2b16 (patch)
tree695dd8ef4a8f14939e6971199126353b8d028e7c /activerecord/test/cases/schema_dumper_test.rb
parentbb45fa05d1681230764af023058af65142c75cff (diff)
downloadrails-42ed16a987c91dcb1705a414b5da15c5275e2b16.tar.gz
rails-42ed16a987c91dcb1705a414b5da15c5275e2b16.tar.bz2
rails-42ed16a987c91dcb1705a414b5da15c5275e2b16.zip
Schema dumping support for PostgreSQL interval type
Closes #27979
Diffstat (limited to 'activerecord/test/cases/schema_dumper_test.rb')
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index 1aed3e46c3..ea860ef5de 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -261,25 +261,31 @@ class SchemaDumperTest < ActiveRecord::TestCase
if current_adapter?(:PostgreSQLAdapter)
def test_schema_dump_includes_bigint_default
- output = standard_dump
+ output = dump_table_schema "defaults"
assert_match %r{t\.bigint\s+"bigint_default",\s+default: 0}, output
end
def test_schema_dump_includes_limit_on_array_type
- output = standard_dump
+ output = dump_table_schema "bigint_array"
assert_match %r{t\.bigint\s+"big_int_data_points\",\s+array: true}, output
end
def test_schema_dump_allows_array_of_decimal_defaults
- output = standard_dump
+ output = dump_table_schema "bigint_array"
assert_match %r{t\.decimal\s+"decimal_array_default",\s+default: \["1.23", "3.45"\],\s+array: true}, output
end
def test_schema_dump_expression_indices
- index_definition = standard_dump.split(/\n/).grep(/t\.index.*company_expression_index/).first.strip
+ index_definition = dump_table_schema("companies").split(/\n/).grep(/t\.index.*company_expression_index/).first.strip
assert_equal 't.index "lower((name)::text)", name: "company_expression_index", using: :btree', index_definition
end
+ def test_schema_dump_interval_type
+ output = dump_table_schema "postgresql_times"
+ assert_match %r{t\.interval\s+"time_interval"$}, output
+ assert_match %r{t\.interval\s+"scaled_time_interval",\s+precision: 6$}, output
+ end
+
if ActiveRecord::Base.connection.supports_extensions?
def test_schema_dump_includes_extensions
connection = ActiveRecord::Base.connection