2014-03-06 68 views
0

我有代码在迁移过程中已被注释掉,但是当我运行代码仍然尝试运行迁移时,该代码已被注释掉。 它提供了以下错误:迁移仍然在代码被注释掉时运行代码

error is PG::Error: ERROR: column "rount_id" of relation "rounds" does not exist 

上述错误就是为什么它已被注释掉的原因。

def up 
    remove_column :rounds, :rount_id 
end 
def down 
    add_column :rounds, :rount_id, :integer 
end 
+0

你可以添加相应的迁移文件吗? –

+0

#def了 ## remove_column:轮,:rount_id #结束 #def下来 #add_column:轮,:rount_id,:整数 #结束 – maggs

+0

你确定你保存你的迁移评论出来后?你是否也确定这个错误是由上面的迁移引发的?你不能编辑你的问题吗? – BroiSatse

回答

0

你确定你是在开发运行它

与下面的代码替换迁移文件,

def change 
    remove_column :rounds, :rount_id, :integer 
end 

和运行

rake db:migrate RAILS_ENV="development"

如果你要评论它,像

def change 
    #remove_column :rounds, :rount_id, :integer 
end