提交 835617b7 编写于 作者: J Jean Boussier

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.
上级 1b4399df
......@@ -61,8 +61,8 @@ def schema_type(column)
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)
......
......@@ -118,7 +118,7 @@ def test_schema_dump_includes_limit_constraint_for_integer_columns
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册