Ruby on rails ActiveRecord::语句无效:PG::UndefinedColumn:错误
尝试运行Ruby on rails ActiveRecord::语句无效:PG::UndefinedColumn:错误,ruby-on-rails,postgresql,ruby-on-rails-4,Ruby On Rails,Postgresql,Ruby On Rails 4,尝试运行rake db:migrate时出错: ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "plus_ids" of relation "comments" does not exist 我想当我试图从我的评论模型中删除属性plus_id时,我确实做了一些奇怪的事情。我不知道发生了什么事 如果我做了一个rake db:reset,然后获取实时数据库,那么所有这些都会在本地再次工作,但是如果我尝试做一个
rake db:migrate
时出错:
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "plus_ids" of relation "comments" does not exist
我想当我试图从我的评论模型中删除属性plus_id时,我确实做了一些奇怪的事情。我不知道发生了什么事
如果我做了一个rake db:reset
,然后获取实时数据库,那么所有这些都会在本地再次工作,但是如果我尝试做一个rake db:migrate
,它会再次抛出一个错误
如何正确地删除plus_id以便迁移
编辑1:以下是我添加(和删除)属性时的迁移文件:
class RemovePlusIdsFromComments < ActiveRecord::Migration
def change
remove_column :comments, :plus_ids, :integer
end
end
有没有办法解决这个问题?答案是跑步
rake db:migrate:up VERSION=20150305204404
在现场和本地,然后
rake db:migrate
这两个都是。现在,实时数据库和本地数据库再次同步,迁移数据库不会引发任何错误。您能否提供迁移文件,其中迁移了
和\u id
?
rake db:migrate:up VERSION=20150305204404
rake db:migrate