2014-03-06 67 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