4
我試圖運行這個遷移:指標名稱太長 - Rails的3
class RemoveClientFromSalesteam < ActiveRecord::Migration
change_table :sales_teams do |t|
t.remove :client_id
end
end
這是我收到的錯誤:
rake db:migrate
-- change_table(:sales_teams)
rake aborted!
An error has occurred, this and all later migrations canceled:
Index name 'temp_index_altered_sales_teams_on_client_priority_and_personal_priority' on table 'altered_sales_teams' is too long; the limit is 64 characters
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
這是我的schema.rb
樣子:
create_table "sales_teams", :force => true do |t|
t.string "name"
t.integer "firm_id"
t.boolean "client_priority"
t.boolean "personal_priority"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "client_id"
end
add_index "sales_teams", ["client_id"], :name => "index_sales_teams_on_client_id"
add_index "sales_teams", ["client_priority", "personal_priority"], :name => "index_sales_teams_on_client_priority_and_personal_priority"
add_index "sales_teams", ["name", "firm_id"], :name => "index_sales_teams_on_name_and_firm_id"
想法?
謝謝。
我正在使用SQLite。有趣。 – marcamillion
@marcamillion:SQLite有一定的限制(http://stackoverflow.com/a/8045311/479863),所以當您嘗試刪除列時,Rails SQLite驅動程序將在您的背後執行復制/刪除/複製。看起來司機有一個錯誤,不知道標識符長度的限制。 –
我試過,但我仍然得到這個錯誤: ' - add_index(:sales_teams,{:column => [:client_priority,:personal_priority]}) rake aborted! 發生錯誤,已取消此次及以後的所有遷移: 表'sales_teams'上的索引名'index_sales_teams_on _ {:column => [:client_priority,:personal_priority]}'太長;限制是64個字符。 – marcamillion