diff options
author | David Heinemeier Hansson <david@envy8-2.local> | 2008-04-29 16:52:52 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@envy8-2.local> | 2008-04-29 16:52:52 -0500 |
commit | 10ef65a3b054270ed3d458ec8eb7c2b9a3e638f7 (patch) | |
tree | 8e7f42e2f296280a039e5c0017a81771144d3169 /activerecord | |
parent | 5514baf63d6d5e19a84c59a0c2cf74f442daed9c (diff) | |
download | rails-10ef65a3b054270ed3d458ec8eb7c2b9a3e638f7.tar.gz rails-10ef65a3b054270ed3d458ec8eb7c2b9a3e638f7.tar.bz2 rails-10ef65a3b054270ed3d458ec8eb7c2b9a3e638f7.zip |
Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [#26 state:resolved]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 9f013c5377..e96c5096e5 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [#26] + * Added that the MySQL adapter should map integer to either smallint, int, or bigint depending on the :limit just like PostgreSQL [DHH] * Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]). Love your database columns, don't LOWER them. [rick] 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. |