diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2015-07-08 14:17:04 -0400 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2015-07-08 14:23:22 -0400 |
commit | 835617b71d2e829c27dbd16a82f22c186c821a0f (patch) | |
tree | fd2fd7d9db0141a06bdc525c7bd0c5316c973bc6 | |
parent | 1b4399dfe7eaa8dd2a75f35815ea429962c51a29 (diff) | |
download | rails-835617b71d2e829c27dbd16a82f22c186c821a0f.tar.gz rails-835617b71d2e829c27dbd16a82f22c186c821a0f.tar.bz2 rails-835617b71d2e829c27dbd16a82f22c186c821a0f.zip |
Do not include column limit in schema.rb if it matches the default
When working on engines that supports multiple databases, it's
very annoying to have a different schema.rb output based on which
database you use. MySQL being the primary offender.
This patch should reduce the disparities a bit.
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb index b944a8631c..5a95cffeca 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb @@ -61,8 +61,8 @@ module ActiveRecord end def schema_limit(column) - limit = column.limit || native_database_types[column.type][:limit] - limit.inspect if limit + limit = column.limit + limit.inspect if limit && limit != native_database_types[column.type][:limit] end def schema_precision(column) diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index feb1c29656..4990863959 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -118,7 +118,7 @@ class SchemaDumperTest < ActiveRecord::TestCase assert_match %r{c_int_4.*}, output assert_no_match %r{c_int_4.*limit:}, output elsif current_adapter?(:MysqlAdapter, :Mysql2Adapter) - assert_match %r{c_int_without_limit.*limit: 4}, output + assert_match %r{c_int_without_limit"$}, output assert_match %r{c_int_1.*limit: 1}, output assert_match %r{c_int_2.*limit: 2}, output |