title: Cannot add a NOT NULL column with default value NULL in Sqlite3
body: <p>I am getting the following error while trying to add a NOT NULL column to an existing table. Why is it happening ?. I tried rake db:reset thinking that the existing records are the problem, but even after resetting the DB, the problem persists. Can you please help me figure this out.</p>
  
  
  
  <p><strong>Migration File</strong></p>
  
  <pre class="lang-ruby prettyprint-override"><code>class AddDivisionIdToProfile &lt; ActiveRecord::Migration
    def self.up
      add_column :profiles, :division_id, :integer, :null =&gt; false
    end
  
    def self.down
      remove_column :profiles, :division_id
    end
  end
  </code></pre>
  
  <p><strong>Error Message</strong></p>
  
  <blockquote>
    <p>SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL: ALTER TABLE "profiles" ADD "division_id" integer NOT NULL</p>
  </blockquote>