ActiveRecord::StatementInvalid: PG::Error: ERROR: null value in column "id" violates not-null constraint

I have same problem once. Here is my problem. I did a

rake db:schema:dump
rake db:schema:load

and the table got problem as below:

create_table "campaign_line_items_backup", :id => false, :force => true do |t|
  t.integer  "id"
  t.integer  "campaign_id"
  t.integer  "size_id"
  t.text     "name"

it should be

create_table "campaign_line_items_backup", :force => true do |t|
  t.integer  "campaign_id"
  t.integer  "size_id"
  t.text     "name"

I am not sure about your problem, That's the way I fixed mine.