Remove index renames in GeneralizeWikiMenuItems

Commented in 8078f73c.

Index renames are no longer needed in Rails 4.0:

> In Rails 4.0 when a column or a table is renamed the related indexes
> are also renamed. If you have migrations which rename the indexes,
> they are no longer needed.

See: http://guides.rubyonrails.org/upgrading_ruby_on_rails.html

[ci skip]

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/2404/merge
Alex Coles 10 years ago
parent 507bfc12bc
commit 62fe6607fa
  1. 6
      db/migrate/20131004141959_generalize_wiki_menu_items.rb

@ -32,21 +32,15 @@ class GeneralizeWikiMenuItems < ActiveRecord::Migration
rename_table :wiki_menu_items, :menu_items rename_table :wiki_menu_items, :menu_items
add_column :menu_items, :type, :string add_column :menu_items, :type, :string
rename_column :menu_items, :wiki_id, :navigatable_id rename_column :menu_items, :wiki_id, :navigatable_id
# rename_index :menu_items, 'index_wiki_menu_items_on_parent_id', 'index_menu_items_on_parent_id'
# rename_index :menu_items, 'index_wiki_menu_items_on_wiki_id_and_title', 'index_menu_items_on_navigatable_id_and_title'
MenuItem.find_each do |menu_item| MenuItem.find_each do |menu_item|
menu_item.update_attribute :type, 'MenuItems::WikiMenuItem' menu_item.update_attribute :type, 'MenuItems::WikiMenuItem'
end end
# TODO rename indexes
end end
def down def down
rename_table :menu_items, :wiki_menu_items rename_table :menu_items, :wiki_menu_items
remove_column :wiki_menu_items, :type remove_column :wiki_menu_items, :type
rename_column :wiki_menu_items, :navigatable_id, :wiki_id rename_column :wiki_menu_items, :navigatable_id, :wiki_id
# rename_index :wiki_menu_items, 'index_menu_items_on_parent_id', 'index_wiki_menu_items_on_parent_id'
# rename_index :wiki_menu_items, 'index_menu_items_on_navigatable_id_and_title', 'index_wiki_menu_items_on_wiki_id_and_title'
end end
end end

Loading…
Cancel
Save