Index: /Code/camping-trunk/lib/camping/session.rb =================================================================== --- /Code/camping-trunk/lib/camping/session.rb (revision 224) +++ /Code/camping-trunk/lib/camping/session.rb (working copy) @@ -60,16 +60,19 @@ # end # def self.create_schema - unless table_exists? - ActiveRecord::Schema.define do - create_table :sessions, :force => true, :id => false do |t| - t.column :hashid, :string, :limit => 32 - t.column :created_at, :datetime - t.column :ivars, :text - end + if !table_exists? || (!column_names.include?("id")) + # We can't just do add_column because we need a pkey column w/auto increment + drop_table :sessions if table_exists? + ActiveRecord::Schema.define do + create_table :sessions, :force => true do |t| + t.column :hashid, :string, :limit => 32, :null => false + t.column :created_at, :datetime + t.column :ivars, :text end - reset_column_information + add_index(:sessions, [:hashid], :unique) end + reset_column_information + end end end end