0
Rails 4.1中的一個非常簡單的遷移失敗,我不明白爲什麼。錯誤:rename_table:關係「TABLE_pkey」不存在
PG::UndefinedTable: ERROR: relation "channel_entries_pkey" does not exist:
ALTER INDEX "channel_entries_pkey" RENAME TO "channels_projects_pkey"
這裏的遷移:
class ConvertChannelEntriesToChannelsProjects < ActiveRecord::Migration
def up
remove_column :channel_entries, :position
rename_table :channel_entries, :channels_projects
end
def down
rename_table :channels_projects, :channel_entries
add_column :channel_entries, :position, :integer
end
end
一點背景:渠道和項目之間的連接一直是HM-THRU命名channel_entries以容納附加position
。由於位置已經被刪除,我正在切換到一個簡單的HABTM,並且按照慣例,連接表現在應該被命名爲channels_projects。
我記得,_pkey
索引是自動爲foreign_key
創建的,但在channel_entries上沒有任何外鍵存在。爲什麼rename_table
想要重命名這個不存在的索引?