diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index c986f0c6f1..86216b6083 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -297,7 +297,14 @@ module ActiveRecord def add_column_options!(sql, options) #:nodoc: sql << " DEFAULT #{quote(options[:default], options[:column])}" if options_include_default?(options) - sql << " NOT NULL" if options[:null] == false + # must explcitly check for :null to allow change_column to work on migrations + if options.has_key? :null + if options[:null] == false + sql << " NOT NULL" + else + sql << " NULL" + end + end end # SELECT DISTINCT clause for a given set of columns and a given ORDER BY clause. |