title: change_column_null for existing column
body: <p>I'm attempting to change the <code>nil</code> possibility of a boolean attribute on the existing column <code>:access_titles</code> on the <code>:profiles</code> table. That column exists because of this migration:</p>
  
  <pre><code>class AddAccessItemsToProfiles &lt; ActiveRecord::Migration
    def self.up
      add_column :profiles, :access_items, :boolean, :default =&gt; true
    end
  
    def self.down
      remove_column :profiles, :access_items, :boolean, :default =&gt; nil
    end
  end
  </code></pre>
  
  <p>To change <code>nil</code>, I tried generating a migration as I always have:</p>
  
  <pre><code>rails g migration ChangeColumnNull :profiles :access_items :null =&gt; false
  </code></pre>
  
  <p>But that did nothing, so I did a standalone migration:</p>
  
  <pre><code>rails g migration AddChangeColumnNullToAccessItems
  </code></pre>
  
  <p>And within that I added:</p>
  
  <pre><code>class AddChangeColumnNullToAccessItems &lt; ActiveRecord::Migration
    def self.up
      change_column_null :profiles, :access_items, :boolean, false
    end
  
    def self.down
      change_column_null :profiles, :access_items, :boolean, true
    end
  end
  </code></pre>
  
  <p>I then ran <code>rake db:migrate</code>, restarted my server and saw no changes. So I tried:</p>
  
  <pre><code>class AddChangeColumnNullToAccessItems &lt; ActiveRecord::Migration
    def self.up
      change_column_null :profiles, :access_items, false
    end
  
    def self.down
      change_column_null :profiles, :access_items, true
    end
  end
  </code></pre>
  
  <p>Then did the same thing: <code>rake db:migrate</code>, restarted the server, and nothing changed.</p>
  
  <p>What am I doing wrong? I was hoping to only have the boolean value of <code>:access_items</code> be true and false without having to dump the database.</p>
  
  <p><strong>UPDATE:</strong> Trying <code>change_column_null :profiles, :access_items, false</code> I got an error:</p>
  
  <pre><code>-- change_column_null(:profiles, :access_items, false)
  rake aborted!
  An error has occurred, this and all later migrations canceled:
  
  PGError: ERROR:  column "access_items" contains null values
  : ALTER TABLE "profiles" ALTER "access_items" SET NOT NULL
  </code></pre>
  
  <p>So, per the advice below I had to insert <code>change_column_null :profiles, :access_items, false, true</code> into my migration.</p>