From 7aef09b193f476f936db851f539fa6b778719d11 Mon Sep 17 00:00:00 2001 From: lrbalt Date: Mon, 7 Apr 2008 07:28:25 +0000 Subject: [PATCH] changes migrations by report on mailling list that sqlite has trouble renaming columns. This was partially addressed in 019 and mentioned in 003. Applied to 033 and 034. Thanks Mohammed Firdaus git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@808 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/db/migrate/003_created_at.rb | 4 ++-- tracks/db/migrate/019_convert_todo_to_state_machine.rb | 4 ++-- tracks/db/migrate/033_add_remember_me_to_user.rb | 2 +- tracks/db/migrate/034_rename_word_to_token.rb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tracks/db/migrate/003_created_at.rb b/tracks/db/migrate/003_created_at.rb index fd9d6041..f841ebec 100644 --- a/tracks/db/migrate/003_created_at.rb +++ b/tracks/db/migrate/003_created_at.rb @@ -3,10 +3,10 @@ class CreatedAt < ActiveRecord::Migration # if the column names use symbols instead of strings. # def self.up - rename_column :todos, :created, :created_at + rename_column :todos, 'created', 'created_at' end def self.down - rename_column :todos, :created_at, :created + rename_column :todos, 'created_at', 'created' end end diff --git a/tracks/db/migrate/019_convert_todo_to_state_machine.rb b/tracks/db/migrate/019_convert_todo_to_state_machine.rb index 5bc50d61..84f2f843 100644 --- a/tracks/db/migrate/019_convert_todo_to_state_machine.rb +++ b/tracks/db/migrate/019_convert_todo_to_state_machine.rb @@ -20,7 +20,7 @@ class ConvertTodoToStateMachine < ActiveRecord::Migration end todo.save end - rename_column :todos, :completed, :completed_at + rename_column :todos, 'completed', 'completed_at' #bug in sqlite requires column names as strings remove_column :todos, :done remove_column :todos, :type end @@ -28,7 +28,7 @@ class ConvertTodoToStateMachine < ActiveRecord::Migration def self.down add_column :todos, :done, :integer, :limit => 4, :default => 0, :null => false add_column :todos, :type, :string, :default => "Immediate", :null => false - rename_column :todos, :completed_at, :completed + rename_column :todos, 'completed_at', 'completed' #bug in sqlite requires column names as strings @todos = Todo.find(:all) @todos.each do |todo| todo.done = todo.state == 'completed' diff --git a/tracks/db/migrate/033_add_remember_me_to_user.rb b/tracks/db/migrate/033_add_remember_me_to_user.rb index ddd613a9..25a72849 100644 --- a/tracks/db/migrate/033_add_remember_me_to_user.rb +++ b/tracks/db/migrate/033_add_remember_me_to_user.rb @@ -8,6 +8,6 @@ class AddRememberMeToUser < ActiveRecord::Migration def self.down remove_column :users, :remember_token remove_column :users, :remember_token_expires_at - rename_column :users, :password, :crypted_password + rename_column :users, 'password', 'crypted_password' #bug in sqlite requires column names as strings end end diff --git a/tracks/db/migrate/034_rename_word_to_token.rb b/tracks/db/migrate/034_rename_word_to_token.rb index c9b737f4..9e9e10c6 100644 --- a/tracks/db/migrate/034_rename_word_to_token.rb +++ b/tracks/db/migrate/034_rename_word_to_token.rb @@ -1,9 +1,9 @@ class RenameWordToToken < ActiveRecord::Migration def self.up - rename_column :users, :word, :token + rename_column :users, 'word', 'token' #bug in sqlite requires column names as strings end def self.down - rename_column :users, :token, :word + rename_column :users, 'token', 'word' #bug in sqlite requires column names as strings end end