aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorwallerjake <wallerjake@gmail.com>2015-03-21 17:08:55 -0500
committerwallerjake <wallerjake@gmail.com>2015-03-21 19:32:41 -0500
commit9bc4eb7ee180a434ea0f23388e04061583ebb5b9 (patch)
treef8182328f3431fbe76baed21bcb397554c1b1bd0 /activerecord/test
parent3064533076c83517c7297adeea473fe52f0bb454 (diff)
downloadrails-9bc4eb7ee180a434ea0f23388e04061583ebb5b9.tar.gz
rails-9bc4eb7ee180a434ea0f23388e04061583ebb5b9.tar.bz2
rails-9bc4eb7ee180a434ea0f23388e04061583ebb5b9.zip
Delegate limit to subtype
As described here https://github.com/rails/rails/issues/19420. When using the Postgres BigInt[] field type the big int value was not being translated into schema.rb. This caused the field to become just a regular integer field when building off of schema.rb. This fix will address this by delegating the limit from the subtype to the Array type. https://github.com/rails/rails/issues/19420
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb5
-rw-r--r--activerecord/test/schema/postgresql_specific_schema.rb4
2 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index 6bf4df70eb..6c099719c0 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -248,6 +248,11 @@ class SchemaDumperTest < ActiveRecord::TestCase
assert_match %r{t\.integer\s+"bigint_default",\s+limit: 8,\s+default: 0}, output
end
+ def test_schema_dump_includes_limit_on_array_type
+ output = standard_dump
+ assert_match %r{t\.integer\s+"big_int_data_points\",\s+limit: 8,\s+array: true}, output
+ end
+
if ActiveRecord::Base.connection.supports_extensions?
def test_schema_dump_includes_extensions
connection = ActiveRecord::Base.connection
diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb
index f84be0e7f4..008503bc24 100644
--- a/activerecord/test/schema/postgresql_specific_schema.rb
+++ b/activerecord/test/schema/postgresql_specific_schema.rb
@@ -93,4 +93,8 @@ _SQL
t.binary :binary, limit: 100_000
t.text :text, limit: 100_000
end
+
+ create_table :bigint_array, force: true do |t|
+ t.integer :big_int_data_points, limit: 8, array: true
+ end
end