public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fixed that create database statements would always include "DEFAULT 
NULL" (Nick Sieger) [#334 status:committed]

Conflicts:

  activerecord/CHANGELOG
tarmo (author)
Tue Jul 15 15:11:48 -0700 2008
jeremy (committer)
Tue Jul 15 15:54:20 -0700 2008
commit  275c3ab2a7aac60ad30ab027d1f0b1f041fb016d
tree    96864b108a018b15315fb041124f7906f2ec8d67
parent  0826384a01d7886bea220f6d3208cec02574373d
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *2.1.1 (next release)*
0
 
0
+* Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [#334]
0
+
0
 * change_column_default preserves the not-null constraint. #617 [Tarmo Tänav]
0
 
0
 * Add :tokenizer option to validates_length_of to specify how to split up the attribute string. #507. [David Lowenfels] Example :
...
257
258
259
260
 
 
 
 
261
262
263
...
257
258
259
 
260
261
262
263
264
265
266
0
@@ -257,7 +257,10 @@ module ActiveRecord
0
 
0
       def to_sql
0
         column_sql = "#{base.quote_column_name(name)} #{sql_type}"
0
- add_column_options!(column_sql, :null => null, :default => default) unless type.to_sym == :primary_key
0
+ column_options = {}
0
+ column_options[:null] = null unless null.nil?
0
+ column_options[:default] = default unless default.nil?
0
+ add_column_options!(column_sql, column_options) unless type.to_sym == :primary_key
0
         column_sql
0
       end
0
       alias to_s :to_sql

Comments

    No one has commented yet.