mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
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
This commit is contained in:
parent
e11837a111
commit
7aef09b193
4 changed files with 7 additions and 7 deletions
|
|
@ -3,10 +3,10 @@ class CreatedAt < ActiveRecord::Migration
|
|||
# if the column names use symbols instead of strings.
|
||||
# <http://dev.rubyonrails.org/changeset/2731>
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue