Permalink
Browse files

Replaced hardcoded SessionStore table creation SQL with calls to Acti…

…veRecord adapter migration methods

Otherwise hardcoded table creation SQL was failing on Oracle database
  • Loading branch information...
1 parent 4e3d220 commit c7dd49eb2a319260e8a2a69104ea2323dbfed5d9 @rsim rsim committed with tenderlove Aug 16, 2010
Showing with 6 additions and 8 deletions.
  1. +6 −8 activerecord/lib/active_record/session_store.rb
@@ -59,17 +59,15 @@ def unmarshal(data)
end
def drop_table!
- connection.execute "DROP TABLE #{table_name}"
+ connection.drop_table table_name
end
def create_table!
- connection.execute <<-end_sql
- CREATE TABLE #{table_name} (
- id #{connection.type_to_sql(:primary_key)},
- #{connection.quote_column_name(session_id_column)} VARCHAR(255) UNIQUE,
- #{connection.quote_column_name(data_column_name)} TEXT
- )
- end_sql
+ connection.create_table(table_name) do |t|
+ t.string session_id_column, :limit => 255
+ t.text data_column_name
+ end
+ connection.add_index table_name, session_id_column, :unique => true
end
end

0 comments on commit c7dd49e

Please sign in to comment.