aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2015-09-13 16:45:52 +0900
committerRyuta Kamizono <kamipo@gmail.com>2015-09-16 13:50:00 +0900
commitf7a35cc5cfb1f970cdea58fb9b47e06c57f532f9 (patch)
tree67fed67e78d69821f77d91fd1c2c27d3edc248a3 /activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
parent93181210234411b9a918cca481422eabebe5400e (diff)
downloadrails-f7a35cc5cfb1f970cdea58fb9b47e06c57f532f9.tar.gz
rails-f7a35cc5cfb1f970cdea58fb9b47e06c57f532f9.tar.bz2
rails-f7a35cc5cfb1f970cdea58fb9b47e06c57f532f9.zip
Remove unnecessary display width
The **(11)** does not affect the storage size of the data type, which for an INT will always be 4 bytes. It affects the **display width**. http://www.tocker.ca/2015/07/02/proposal-to-deprecate-mysql-integer-display-width-and-zerofill.html
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb5
1 files changed, 3 insertions, 2 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 597f0d0597..a06e7c85eb 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -246,7 +246,7 @@ module ActiveRecord
QUOTED_TRUE, QUOTED_FALSE = '1', '0'
NATIVE_DATABASE_TYPES = {
- primary_key: "int(11) auto_increment PRIMARY KEY",
+ primary_key: "int auto_increment PRIMARY KEY",
string: { name: "varchar", limit: 255 },
text: { name: "text" },
integer: { name: "int", limit: 4 },
@@ -1036,8 +1036,9 @@ module ActiveRecord
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
- when nil, 4, 11; 'int(11)' # compatibility with MySQL default
+ when nil, 4; 'int'
when 5..8; 'bigint'
+ when 11; 'int(11)' # backward compatibility with Rails 2.0
else raise(ActiveRecordError, "No integer type has byte size #{limit}")
end
end