public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
MySQL: omit text/blob defaults from the schema instead of using an empty string. 
Closes #10963.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8757 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jeremy (author)
Wed Jan 30 15:22:58 -0800 2008
commit  e59978aa867ef07e16ad64f73f1ed5cafa98d0ea
tree    b217d43b0a2547089b3cb7f30ce9a60c74c6ef68
parent  1ba5fc745bbe4ad9dacbfe6aa41138ec68540cc7
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* MySQL: omit text/blob defaults from the schema instead of using an empty string.  #10963 [mdeiters]
0
+
0
 * belongs_to supports :dependent => :destroy and :delete.  #10592 [Jonathan Viney]
0
 
0
 * Introduce preload query strategy for eager :includes.  #9640 [Frederick Cheung, Aleksey Kondratenko]
...
94
95
96
97
 
98
99
100
...
94
95
96
 
97
98
99
100
0
@@ -94,7 +94,7 @@ module ActiveRecord
0
       def extract_default(default)
0
         if type == :binary || type == :text
0
           if default.blank?
0
-            default
0
+            nil
0
           else
0
             raise ArgumentError, "#{type} columns cannot have a default value: #{default.inspect}"
0
           end
...
853
854
855
856
857
858
859
860
 
861
862
863
...
853
854
855
 
 
 
 
 
856
857
858
859
0
@@ -853,11 +853,7 @@ if ActiveRecord::Base.connection.supports_migrations?
0
       columns = Person.connection.columns(:binary_testings)
0
       data_column = columns.detect { |c| c.name == "data" }
0
 
0
-      if current_adapter?(:MysqlAdapter)
0
-        assert_equal '', data_column.default
0
-      else
0
-        assert_nil data_column.default
0
-      end
0
+      assert_nil data_column.default
0
 
0
       Person.connection.drop_table :binary_testings rescue nil
0
     end
...
84
85
86
87
88
89
90
...
96
97
98
99
100
101
102
...
108
109
110
111
 
112
113
114
...
84
85
86
 
87
88
89
...
95
96
97
 
98
99
100
...
106
107
108
 
109
110
111
112
0
@@ -84,7 +84,6 @@ if ActiveRecord::Base.connection.respond_to?(:tables)
0
       assert_no_match %r{create_table "schema_info"}, output
0
     end
0
 
0
-
0
     def test_schema_dump_with_regexp_ignored_table
0
       stream = StringIO.new
0
 
0
@@ -96,7 +95,6 @@ if ActiveRecord::Base.connection.respond_to?(:tables)
0
       assert_no_match %r{create_table "schema_info"}, output
0
     end
0
 
0
-
0
     def test_schema_dump_illegal_ignored_table_value
0
       stream = StringIO.new
0
       ActiveRecord::SchemaDumper.ignore_tables = [5]
0
@@ -108,7 +106,7 @@ if ActiveRecord::Base.connection.respond_to?(:tables)
0
     if current_adapter?(:MysqlAdapter)
0
       def test_schema_dump_should_not_add_default_value_for_mysql_text_field
0
         output = standard_dump
0
-        assert_match %r{t.text\s+"body",\s+:default => "",\s+:null => false$}, output
0
+        assert_match %r{t.text\s+"body",\s+:null => false$}, output
0
       end
0
 
0
       def test_mysql_schema_dump_should_honor_nonstandard_primary_keys

Comments