title: Changing fields to NOT NULL with NULL fields using migrations
body: <p>So I mistakenly created a table with fields which should have been NOT NULL.</p>
  
  <p>I need to create a migration to change the fields from NULLABLE to NOT NULL, but some rows exist which are already NULL.</p>
  
  <p>Hoe can I update these rows and change the fields?  I tried this:</p>
  
  <pre><code>  def change
      change_column :countries, :effective_date, :date, :null =&gt; false, :default =&gt; Time.now
      change_column :countries, :expiry_date, :date, :null =&gt; false, :default =&gt; Time.new(9999,12,31)
    end
  </code></pre>
  
  <p>But this failed with an error:</p>
  
  <p>Mysql2::Error: Invalid use of NULL value: ALTER TABLE</p>
  
  <p>Any ideas?  Needs to work on both mysql and sql server..</p>