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