aboutsummaryrefslogtreecommitdiffstats
path: root/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb
blob: 0ce6cb2a46a3bd9682e034944bf96c1f62cede06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class RenameCustomTitleToMenuTitleInRefineryPages < ActiveRecord::Migration
  def up
    if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:custom_title)
      rename_column ::Refinery::Page::Translation.table_name, :custom_title, :menu_title
    end
    remove_column ::Refinery::Page.table_name, :custom_title_type
  end

  def down
    if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:menu_title)
      rename_column ::Refinery::Page::Translation.table_name, :menu_title, :custom_title
    end
    add_column ::Refinery::Page.table_name, :custom_title_type, :string
  end
end