diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-03-11 02:09:02 -0300 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-03-11 02:09:02 -0300 |
commit | a101115d5b8011278891f30f69901f9583ea7685 (patch) | |
tree | 8e5e55c50f3f8e4463908406631c7454bbaae1e5 /activerecord | |
parent | de483660ea9b8a0d11362e77a1fe1d870c0e7286 (diff) | |
parent | a449b073430b28644b4e2a5e6a1b5615c1b2d67b (diff) | |
download | rails-a101115d5b8011278891f30f69901f9583ea7685.tar.gz rails-a101115d5b8011278891f30f69901f9583ea7685.tar.bz2 rails-a101115d5b8011278891f30f69901f9583ea7685.zip |
Merge pull request #23958 from kamipo/fix_bigserial_appears_with_limit_8
Fix bigserial appears with limit 8 for schema dumper
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/serial_test.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb index 19761618cf..5cb2bbbf18 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb @@ -41,6 +41,10 @@ module ActiveRecord end end + def schema_limit(column) + super unless schema_type(column) == :bigserial + end + def schema_expression(column) super unless column.serial? end diff --git a/activerecord/test/cases/adapters/postgresql/serial_test.rb b/activerecord/test/cases/adapters/postgresql/serial_test.rb index 7d30db247b..2d6f1e0910 100644 --- a/activerecord/test/cases/adapters/postgresql/serial_test.rb +++ b/activerecord/test/cases/adapters/postgresql/serial_test.rb @@ -26,7 +26,7 @@ class PostgresqlSerialTest < ActiveRecord::PostgreSQLTestCase def test_schema_dump_with_shorthand output = dump_table_schema "postgresql_serials" - assert_match %r{t\.serial\s+"seq"}, output + assert_match %r{t\.serial\s+"seq",\s+null: false$}, output end end @@ -55,6 +55,6 @@ class PostgresqlBigSerialTest < ActiveRecord::PostgreSQLTestCase def test_schema_dump_with_shorthand output = dump_table_schema "postgresql_big_serials" - assert_match %r{t\.bigserial\s+"seq"}, output + assert_match %r{t\.bigserial\s+"seq",\s+null: false$}, output end end |