This project is archived and is in readonly mode.
Fix for change_column :null => true in migrations
Reported by Nate Wiger | April 19th, 2008 @ 09:02 PM
Currently, using change_column with :null => true on a formerly :null => false column does not have the proper effect. This patch fixes this issue by explicitly checking the keys for :null. I have been using this in a production setting for a while with no issues.
Note: This patch can't be compressed further (outside of syntactic trickery). It's very important to not do anything unless the :null option is present. Otherwise, you can generate bad SQL which attempts to re-set a NOT NULL column to NOT NULL, and Oracle in particular will generate a fatal error.
I couldn't figure out how to test this patch within the AR test framework, as the actual table definition needs to be reverified. I have tested this on mysql and Oracle on my end and it works well.
Thanks, Nate
Comments and changes to this ticket
-
John Barnette April 22nd, 2008 @ 08:24 AM
- Title changed from [PATCH] Fix for change_column :null => true in migrations to Fix for change_column :null => true in migrations
-
Repository April 29th, 2008 @ 10:53 PM
- State changed from new to resolved
(from [10ef65a3b054270ed3d458ec8eb7c2b9a3e638f7]) Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [#26 state:resolved]
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 398 Non-standard SQL generated in column definition for nullable columns in create table DDL (rails 2.1) Discussed here, in ticket #26: