diff options
author | Court3nay <courtenay@entp.com> | 2015-02-24 13:59:00 -0500 |
---|---|---|
committer | Court3nay <courtenay@entp.com> | 2015-02-24 13:59:00 -0500 |
commit | ee87dbe0480db6f936ad07addf9f6e64068457ef (patch) | |
tree | 78648c8e13758e4ca517f39c70728d8383862073 | |
parent | a0580e974b4a058a983de6c593e4573bd94b76f0 (diff) | |
download | rails-ee87dbe0480db6f936ad07addf9f6e64068457ef.tar.gz rails-ee87dbe0480db6f936ad07addf9f6e64068457ef.tar.bz2 rails-ee87dbe0480db6f936ad07addf9f6e64068457ef.zip |
Fix mysql's schema.rb dumper so it does not include limit on emulated boolean tinyint(1) fields
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 8ec26bc109..98009da2bd 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -98,6 +98,7 @@ module ActiveRecord def prepare_column_options(column) spec = super spec.delete(:precision) if /time/ === column.sql_type && column.precision == 0 + spec.delete(:limit) if :boolean === column.type spec end diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 7d8d6421a9..513f65f707 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -225,6 +225,11 @@ class SchemaDumperTest < ActiveRecord::TestCase assert_match %r{t\.text\s+"long_text",\s+limit: 4294967295$}, output end + def test_schema_does_not_include_limit_for_emulated_mysql_boolean_fields + output = standard_dump + assert_no_match %r{t\.boolean\s+"has_fun",.+limit: 1}, output + end + def test_schema_dumps_index_type output = standard_dump assert_match %r{add_index "key_tests", \["awesome"\], name: "index_key_tests_on_awesome", type: :fulltext}, output |