aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate/20130611193609_translate_page_image_captions.refinery_page_images.rb
blob: c2b3ebc2940fb93b9615c1a4abe064daa0254e56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# This migration comes from refinery_page_images (originally 20110511215016)
class TranslatePageImageCaptions < ActiveRecord::Migration
  def up
    add_column Refinery::ImagePage.table_name, :id, :primary_key

    Refinery::ImagePage.reset_column_information
    unless defined?(Refinery::ImagePage::Translation) && Refinery::ImagePage::Translation.table_exists?
      Refinery::ImagePage.create_translation_table!({
        :caption => :text
      }, {
        :migrate_data => true
      })
    end
  end

  def down
    Refinery::ImagePage.reset_column_information

    Refinery::ImagePage.drop_translation_table! :migrate_data => true

    remove_column Refinery::ImagePage.table_name, :id
  end
end