Permalink
Browse files

Omit the default limit for float columns (#28041)

  • Loading branch information...
kamipo committed Aug 27, 2017
1 parent 376e19c commit 7ff3bc125373c76e58f46463f6cff6dac15b15dd
@@ -33,7 +33,7 @@ class AbstractMysqlAdapter < AbstractAdapter
string: { name: "varchar", limit: 255 },
text: { name: "text", limit: 65535 },
integer: { name: "int", limit: 4 },
float: { name: "float" },
float: { name: "float", limit: 24 },
decimal: { name: "decimal" },
datetime: { name: "datetime" },
timestamp: { name: "timestamp" },
@@ -62,7 +62,7 @@ class UnsignedType < ActiveRecord::Base
schema = dump_table_schema "unsigned_types"
assert_match %r{t\.integer\s+"unsigned_integer",\s+unsigned: true$}, schema
assert_match %r{t\.bigint\s+"unsigned_bigint",\s+unsigned: true$}, schema
assert_match %r{t\.float\s+"unsigned_float",\s+limit: 24,\s+unsigned: true$}, schema
assert_match %r{t\.float\s+"unsigned_float",\s+unsigned: true$}, schema
assert_match %r{t\.decimal\s+"unsigned_decimal",\s+precision: 10,\s+scale: 2,\s+unsigned: true$}, schema
end
end
@@ -207,20 +207,25 @@ def test_schema_dump_should_honor_nonstandard_primary_keys
end
def test_schema_dump_should_use_false_as_default
output = standard_dump
output = dump_table_schema "booleans"
assert_match %r{t\.boolean\s+"has_fun",.+default: false}, output
end
def test_schema_dump_does_not_include_limit_for_text_field
output = standard_dump
output = dump_table_schema "admin_users"
assert_match %r{t\.text\s+"params"$}, output
end
def test_schema_dump_does_not_include_limit_for_binary_field
output = standard_dump
output = dump_table_schema "binaries"
assert_match %r{t\.binary\s+"data"$}, output
end
def test_schema_dump_does_not_include_limit_for_float_field
output = dump_table_schema "numeric_data"
assert_match %r{t\.float\s+"temperature"$}, output
end
if current_adapter?(:Mysql2Adapter)
def test_schema_dump_includes_length_for_mysql_binary_fields
output = standard_dump

0 comments on commit 7ff3bc1

Please sign in to comment.