diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-07-14 10:12:54 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-07-14 10:12:54 -0500 |
commit | 30370227890dc950f1544b7b1040aa75e505f877 (patch) | |
tree | 06f1b423c32d55ea7ff7f4ff0108adbb52ff9713 /activerecord/lib/active_record/connection_adapters | |
parent | 0176e6adb388998414083e99523de318d3b8ca49 (diff) | |
download | rails-30370227890dc950f1544b7b1040aa75e505f877.tar.gz rails-30370227890dc950f1544b7b1040aa75e505f877.tar.bz2 rails-30370227890dc950f1544b7b1040aa75e505f877.zip |
Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [#334 status:committed]
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index d4c8a80448..13ccfea0b8 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -257,7 +257,10 @@ module ActiveRecord def to_sql column_sql = "#{base.quote_column_name(name)} #{sql_type}" - add_column_options!(column_sql, :null => null, :default => default) unless type.to_sym == :primary_key + column_options = {} + column_options[:null] = null unless null.nil? + column_options[:default] = default unless default.nil? + add_column_options!(column_sql, column_options) unless type.to_sym == :primary_key column_sql end alias to_s :to_sql |