diff options
-rw-r--r-- | activerecord/lib/active_record/session_store.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index bd3be93abb..01cc14b8d6 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -59,17 +59,15 @@ module ActiveRecord 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 |