2
從今天上午開始,我面對Rails設計中的奇怪問題。以下是我的ls和rake db version命令的輸出。rails遷移版本問題:任何新的遷移不起作用
[email protected]:~/git-public/personaldiary/db/migrate$ ls -1
20120110083934_devise_create_users.rb
20120110090514_create_posts.rb
20120110090845_add_user_id_to_post.rb
20120203035323_add_confirmable_to_devise.rb
20120203035323_add_confirmable_to_devise.rb~
20120203043601_add_lockable_to_devise.rb
20120203043601_add_lockable_to_devise.rb~
[email protected]:~/git-public/personaldiary/db/migrate$ rake db:version
(in /home/hrishikesh/git-public/personaldiary)
DEPRECATION WARNING: require "activerecord" is deprecated and will be removed in Rails 3. Use require "active_record" instead. (called from /usr/lib/ruby/vendor_ruby/activerecord.rb:2)
Current version: 20120203034555
[email protected]:~/git-public/personaldiary/db/migrate$
如果我嘗試添加任何新的遷移,rake db:migrate throws錯誤,告訴我某列已經存在並失敗。
我的失敗遷移代碼是在這裏:
class AddConfirmableToDevise < ActiveRecord::Migration
def change
change_table(:users) do |t|
t.confirmable
end
add_index :users, :confirmation_token, :unique => true
end
end
我特別不希望使用上下因爲this
方法請幫助。
您可以在此處粘貼失敗的遷移代碼。 – Vik 2012-02-03 05:45:42
@Vik:編輯過的文章有詳細信息。 – riship89 2012-02-03 05:58:28