diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-12-24 23:05:17 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-12-24 23:05:17 +0900 |
commit | 06ba969cf5740c587bc618c9459cd704d6c103f4 (patch) | |
tree | b08cfd29d74e592049e6d3747078a6c61ddc370e /activerecord/test/cases | |
parent | fefd76e82af28decb895c22bbe1bbf265a2a8b75 (diff) | |
download | rails-06ba969cf5740c587bc618c9459cd704d6c103f4.tar.gz rails-06ba969cf5740c587bc618c9459cd704d6c103f4.tar.bz2 rails-06ba969cf5740c587bc618c9459cd704d6c103f4.zip |
Fix varbinary with default ''
A `(?:var)?binary` with default '' is a correct definition.
Remove `missing_default_forged_as_empty_string?` method for fixing this
issue because this method is a workaround for older mysql legacy adapter
(19c99ac, f7015336).
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/column_definition_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/column_definition_test.rb b/activerecord/test/cases/column_definition_test.rb index da0d7f5195..783a374116 100644 --- a/activerecord/test/cases/column_definition_test.rb +++ b/activerecord/test/cases/column_definition_test.rb @@ -49,6 +49,16 @@ module ActiveRecord assert_equal "a", varbinary_column.default end + def test_should_be_empty_string_default_for_mysql_binary_data_types + type = SqlTypeMetadata.new(type: :binary, sql_type: "binary(1)") + binary_column = AbstractMysqlAdapter::Column.new("title", "", type, false) + assert_equal "", binary_column.default + + type = SqlTypeMetadata.new(type: :binary, sql_type: "varbinary") + varbinary_column = AbstractMysqlAdapter::Column.new("title", "", type, false) + assert_equal "", varbinary_column.default + end + def test_should_not_set_default_for_blob_and_text_data_types assert_raise ArgumentError do AbstractMysqlAdapter::Column.new("title", "a", SqlTypeMetadata.new(sql_type: "blob")) |