I have an existing Rails 3.2 app, and I would like to store sessions in a Postgresql database. I found this tutorial on Stackoverflow and followed Diego Pino's directions.
However, when I got to the rake db:migrate step, I got the following error:
PG::Error: ERROR: foreign key constraint "sessions_session_id_fkey" cannot be implemented DETAIL: Key columns "session_id" and "id" are of incompatible types: character varying and integer.
Here's the SQL that it's trying to execute:
CREATE TABLE "sessions" ("id" serial primary key, 
    "session_id" character varying(255) NOT NULL, 
    "data" text,
    "created_at" timestamp NOT NULL, 
    "updated_at" timestamp NOT NULL, 
    FOREIGN KEY ("session_id") REFERENCES "sessions" ("id"))
And here's the migration that was automatically created:
class AddSessionsTable < ActiveRecord::Migration                                    
  def change
    create_table :sessions do |t|
      t.string :session_id, :null => false
      t.text :date
      t.timestamps
    end
    add_index :sessions, :session_id
    add_index :sessions, :updated_at
  end
end
The confusing part to me is that I don't see any foreign key constraint declarations in the migration. So why is the generated sql trying to link together a text field and an integer field?
UPDATE 1
Kevin requested the contents of my config/initializers/session_store.rb file:
# Be sure to restart your server when you modify this file.
Calliope::Application.config.session_store :cookie_store, key: '_calliope_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
#Calliope::Application.config.session_store :active_record_store
I tried re-running the rake db:migrate command after uncommenting the :active_record_store line at the bottom, but that didn't change the outcome.
I also do not have an existing sessions table in either my Dev or Test databases.