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