From f10e5b102ef6b8cbc32d69527ea8d81e1526e2fd Mon Sep 17 00:00:00 2001 From: bsag Date: Sat, 27 May 2006 10:27:32 +0000 Subject: [PATCH] Changes made to the default datestamp in the migrations to fix compatability with PostgreSQL (see #218) caused even new actions to be marked as stale (#257). This also affected SQLite3, as reported by Sjoerd Siebinga on the mailing list. This changeset sets the default datestamp using Rails to set a db-appropriate format. It fixes SQLite3, and I hope also PostgreSQL though I can't test this. Fixes #257. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@249 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/db/migrate/001_create_tracks_db.rb | 2 +- tracks/db/migrate/004_notes.rb | 4 +-- tracks/db/schema.rb | 38 +++++++++++----------- tracks/db/tracks-1041.db | Bin 11264 -> 11264 bytes 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tracks/db/migrate/001_create_tracks_db.rb b/tracks/db/migrate/001_create_tracks_db.rb index 86d66f9b..cc89ebae 100644 --- a/tracks/db/migrate/001_create_tracks_db.rb +++ b/tracks/db/migrate/001_create_tracks_db.rb @@ -19,7 +19,7 @@ class CreateTracksDb < ActiveRecord::Migration t.column :description, :string, :null => false t.column :notes, :text t.column :done, :boolean, :default => false, :null => false - t.column :created, :datetime, :default => '0000-01-01 00:00:00' + t.column :created, :datetime, :default => Time.now.to_s(:db) t.column :due, :date t.column :completed, :datetime end diff --git a/tracks/db/migrate/004_notes.rb b/tracks/db/migrate/004_notes.rb index b19be711..b71e4424 100644 --- a/tracks/db/migrate/004_notes.rb +++ b/tracks/db/migrate/004_notes.rb @@ -4,8 +4,8 @@ class Notes < ActiveRecord::Migration t.column :user_id, :integer, :null => false t.column :project_id, :integer, :null => false t.column :body, :text - t.column :created_at, :datetime, :default => '0000-01-01 00:00:00' - t.column :updated_at, :datetime, :default => '0000-01-01 00:00:00' + t.column :created_at, :datetime, :default => Time.now.to_s(:db) + t.column :updated_at, :datetime, :default => Time.now.to_s(:db) end end diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb index f3aa4036..e5abfd21 100644 --- a/tracks/db/schema.rb +++ b/tracks/db/schema.rb @@ -5,26 +5,26 @@ ActiveRecord::Schema.define(:version => 8) do create_table "contexts", :force => true do |t| - t.column "name", :string, :default => "", :null => false - t.column "hide", :integer, :limit => 4, :default => 0, :null => false - t.column "position", :integer, :default => 0, :null => false + t.column "name", :string, :null => false + t.column "position", :integer, :null => false + t.column "hide", :boolean, :default => false t.column "user_id", :integer, :default => 1 end create_table "notes", :force => true do |t| - t.column "user_id", :integer, :default => 0, :null => false - t.column "project_id", :integer, :default => 0, :null => false + t.column "user_id", :integer, :null => false + t.column "project_id", :integer, :null => false t.column "body", :text - t.column "created_at", :datetime - t.column "updated_at", :datetime + t.column "created_at", :datetime, :default => Sat May 27 11:22:19 BST 2006 + t.column "updated_at", :datetime, :default => Sat May 27 11:22:19 BST 2006 end create_table "projects", :force => true do |t| - t.column "name", :string, :default => "", :null => false - t.column "position", :integer, :default => 0, :null => false - t.column "done", :integer, :limit => 4, :default => 0, :null => false + t.column "name", :string, :null => false + t.column "position", :integer, :null => false + t.column "done", :boolean, :default => false t.column "user_id", :integer, :default => 1 - t.column "description", :text + t.column "description", :text, :default => "" end create_table "sessions", :force => true do |t| @@ -36,24 +36,24 @@ ActiveRecord::Schema.define(:version => 8) do 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 "description", :string, :limit => 100, :default => "", :null => false + t.column "context_id", :integer, :null => false + t.column "project_id", :integer + t.column "description", :string, :null => false t.column "notes", :text - t.column "done", :integer, :limit => 4, :default => 0, :null => false - t.column "created_at", :datetime + t.column "done", :boolean, :default => false, :null => false + t.column "created_at", :datetime, :default => Sat May 27 11:22:16 BST 2006 t.column "due", :date t.column "completed", :datetime - t.column "project_id", :integer t.column "user_id", :integer, :default => 1 t.column "type", :string, :default => "Immediate", :null => false t.column "show_from", :date end create_table "users", :force => true do |t| - t.column "login", :string, :limit => 80 - t.column "password", :string, :limit => 40 + t.column "login", :string, :limit => 80, :null => false + t.column "password", :string, :limit => 40, :null => false t.column "word", :string - t.column "is_admin", :integer, :limit => 4, :default => 0, :null => false + t.column "is_admin", :boolean, :default => false, :null => false t.column "preferences", :text end diff --git a/tracks/db/tracks-1041.db b/tracks/db/tracks-1041.db index 559f6244916508cb8c39021de7f731d5662cf7e8..220c209844c046055384f22ecdda99cc825d3341 100644 GIT binary patch delta 83 zcmZpOXo#2~&G>br%sMGyBLf37T?12HBXb2qLn|XAD?`i4ccqlDiEkE?E@TowQ*E|+ IvTQCN0GB-!fdBvi delta 83 zcmZpOXo#2~%_zB1W}TF<0TAdK7y^-kfq@kmO};CogiU<2kaQuF0J`eUlVx-H07lyr AJ^%m!