title: rails 4 ActiveRecord::StatementInvalid
body: <p>While upgrading rails application from rails3.2 to rails 4. I am getting a issue </p>
  
  <blockquote>
    <p>ActiveRecord::StatementInvalid in SessionsController#new</p>
    
    <p>Mysql::Error: Field 'session_id' doesn't have a default value: INSERT
    INTO <code>sessions</code> (<code>created_at</code>, <code>data</code>, <code>updated_at</code>) VALUES (?, ?, ?)</p>
  </blockquote>
  
  <p>In my sessions table I have session_id field, But I don't know how to set default value. </p>
  
  <p>can u help me to resolve this issue?</p>
  
  <p>my add_sessions_table.rb migration file:</p>
  
  <blockquote>
    <p>class AddSessionsTable &lt; ActiveRecord::Migration</p>
    
    <p>def change</p>
  
  <pre><code>create_table :sessions do |t|
    t.string :session_id, :null =&gt; false
    t.text :data
    t.timestamps
  end
  
  add_index :sessions, :session_id
  add_index :sessions, :updated_at    
  end
  </code></pre>
    
    <p>end</p>
  </blockquote>
  
  <p>my sessions_store.rb file </p>
  
  <blockquote>
    <p>MyApp::Application.config.session_store :active_record_store</p>
  </blockquote>
  
  <p>Thanks</p>