From 62087003f19b1bfafa78ac7dc4e320ca676691a6 Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 12 Feb 2006 15:53:42 +0000 Subject: [PATCH] Sessions are now stored in the database rather than files in tracks/tmp. tracks/tmp.tmpl is no longer needed. This prevents the file system from becoming littered with file, and should help performance. You need to run rake migrate to get your database up to schema version 7 to add the necessary session table to your database. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@183 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/config/environment.rb | 2 +- tracks/config/environments/development.rb | 2 +- tracks/db/migrate/007_add_sessions_table.rb | 15 +++++++++++++++ tracks/db/schema.rb | 10 +++++++++- tracks/doc/CHANGELOG | 1 + 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 tracks/db/migrate/007_add_sessions_table.rb diff --git a/tracks/config/environment.rb b/tracks/config/environment.rb index a33d732f..811e6618 100644 --- a/tracks/config/environment.rb +++ b/tracks/config/environment.rb @@ -20,7 +20,7 @@ Rails::Initializer.run do |config| # Use the database for sessions instead of the file system # (create the session table with 'rake create_sessions_table') - # config.action_controller.session_store = :active_record_store + config.action_controller.session_store = :active_record_store # Enable page/fragment caching by setting a file-based store # (remember to create the caching directory and make it readable to the application) diff --git a/tracks/config/environments/development.rb b/tracks/config/environments/development.rb index 66f9c060..77a4205d 100644 --- a/tracks/config/environments/development.rb +++ b/tracks/config/environments/development.rb @@ -18,4 +18,4 @@ config.action_mailer.raise_delivery_errors = false # Unique cookies ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:session_key] = "TrackDev" -ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:tmpdir] = "#{RAILS_ROOT}/tmp" \ No newline at end of file +# ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:tmpdir] = "#{RAILS_ROOT}/tmp" \ No newline at end of file diff --git a/tracks/db/migrate/007_add_sessions_table.rb b/tracks/db/migrate/007_add_sessions_table.rb new file mode 100644 index 00000000..4f727ce0 --- /dev/null +++ b/tracks/db/migrate/007_add_sessions_table.rb @@ -0,0 +1,15 @@ +class AddSessionsTable < ActiveRecord::Migration + def self.up + create_table :sessions do |t| + t.column :session_id, :string + t.column :data, :text + t.column :updated_at, :datetime + end + + add_index :sessions, :session_id + end + + def self.down + drop_table :sessions + end +end diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb index 6da455ae..d332da39 100644 --- a/tracks/db/schema.rb +++ b/tracks/db/schema.rb @@ -2,7 +2,7 @@ # migrations feature of ActiveRecord to incrementally modify your database, and # then regenerate this schema definition. -ActiveRecord::Schema.define(:version => 6) do +ActiveRecord::Schema.define(:version => 7) do create_table "contexts", :force => true do |t| t.column "name", :string, :default => "", :null => false @@ -27,6 +27,14 @@ ActiveRecord::Schema.define(:version => 6) do t.column "description", :text end + create_table "sessions", :force => true do |t| + t.column "session_id", :string + t.column "data", :text + t.column "updated_at", :datetime + end + + add_index "sessions", ["session_id"], :name => "sessions_session_id_index" + create_table "todos", :force => true do |t| t.column "context_id", :integer, :default => 0, :null => false t.column "project_id", :integer diff --git a/tracks/doc/CHANGELOG b/tracks/doc/CHANGELOG index 0722eb84..ff587b55 100644 --- a/tracks/doc/CHANGELOG +++ b/tracks/doc/CHANGELOG @@ -36,6 +36,7 @@ Wiki (deprecated - please use Trac): http://www.rousette.org.uk/projects/wiki/ 18. Validation errors are now reported in a status box (just above the new next action form). 19. There's a rake task (upgrade_sqlite_db) which allows you to safely upgrade databases created with version 1.03, afterwhich you can run rake migrate to complete the process. From there, rake migrate should work OK. 20. Moved settings for Tracks from the file settings.yml to the database. Running 'rake migrate' will update your database appropriately, and add the default settings into it. Then you should be able to visit http://0.0.0.0:3000/user/preferences to view and edit your settings. The advantage is that you don't need to mess about with the settings.yml file, and each of the users can have their own settings. +21. Session data is now stored in the database rather than a file in tracks/tmp. This should prevent the tmp directory cluttering up the file system, and give better performance. You need to run rake migrate to add the session table to your database. == Version 1.03