public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fixed that change_column should be able to use :null => true on a field that 
formerly had false [Nate Wiger] [#26 state:resolved]
David Heinemeier Hansson (author)
Tue Apr 29 14:52:52 -0700 2008
commit  10ef65a3b054270ed3d458ec8eb7c2b9a3e638f7
tree    8e7f42e2f296280a039e5c0017a81771144d3169
parent  5514baf63d6d5e19a84c59a0c2cf74f442daed9c
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [#26]
0
+
0
 * Added that the MySQL adapter should map integer to either smallint, int, or bigint depending on the :limit just like PostgreSQL [DHH]
0
 
0
 * Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]).  Love your database columns, don't LOWER them.  [rick]
...
297
298
299
300
 
 
 
 
 
 
 
 
301
302
303
...
297
298
299
 
300
301
302
303
304
305
306
307
308
309
310
0
@@ -297,7 +297,14 @@ module ActiveRecord
0
 
0
       def add_column_options!(sql, options) #:nodoc:
0
         sql << " DEFAULT #{quote(options[:default], options[:column])}" if options_include_default?(options)
0
-        sql << " NOT NULL" if options[:null] == false
0
+        # must explcitly check for :null to allow change_column to work on migrations
0
+        if options.has_key? :null
0
+          if options[:null] == false
0
+            sql << " NOT NULL"
0
+          else
0
+            sql << " NULL"
0
+          end
0
+        end
0
       end
0
 
0
       # SELECT DISTINCT clause for a given set of columns and a given ORDER BY clause.

Comments