diff options
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 1 | ||||
-rw-r--r-- | activerecord/test/migration_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/schema_dumper_test.rb | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 7edf5b0f2d..47a1b355f8 100755 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -92,6 +92,7 @@ module ActiveRecord @original_default = default super @default = nil if no_default_allowed? || missing_default_forged_as_empty_string? + @default = '' if @original_default == '' && no_default_allowed? end private diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index d1e2059c9a..727ce86d30 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -748,7 +748,7 @@ if ActiveRecord::Base.connection.supports_migrations? columns = Person.connection.columns(:binary_testings) data_column = columns.detect { |c| c.name == "data" } - assert_nil data_column.default + assert_equal '', data_column.default Person.connection.drop_table :binary_testings rescue nil end diff --git a/activerecord/test/schema_dumper_test.rb b/activerecord/test/schema_dumper_test.rb index d18b99d561..fa2b8bdf24 100644 --- a/activerecord/test/schema_dumper_test.rb +++ b/activerecord/test/schema_dumper_test.rb @@ -108,7 +108,7 @@ if ActiveRecord::Base.connection.respond_to?(:tables) if current_adapter?(:MysqlAdapter) def test_schema_dump_should_not_add_default_value_for_mysql_text_field output = standard_dump - assert_match %r{t.text\s+"body",\s+:null => false$}, output + assert_match %r{t.text\s+"body",\s+:default => "",\s+:null => false$}, output end end |