Sha256: 956e6e0988700d269bcc8818de24e77ffae3d7c39fd8380db6f96957c467e90b

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 Bytes

Contents

# This migration comes from tb_cms (originally 20121119030136)
class ChangeLiquidTagsToPolymorphic < ActiveRecord::Migration
  def up
    rename_column :spud_page_liquid_tags, :spud_page_partial_id, :attachment_id
    add_column :spud_page_liquid_tags, :attachment_type, :string
    add_index :spud_page_liquid_tags, [:attachment_type, :attachment_id], :name => 'inde_spud_page_liquid_tags_on_attachment'
    if defined?(SpudPageLiquidTag)
      SpudPageLiquidTag.all.each do |f|
        f.update_attributes(:attachment_type => "SpudPagePartial")
      end
    end
  end

  def down
    rename_column :spud_page_liquid_tags, :attachment_id, :spud_page_partial_id
    remove_column :spud_page_liquid_tags, :attachment_type
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tb_cms-1.2.3 spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
tb_cms-1.2.2 spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
tb_cms-1.2.1 spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
tb_cms-1.2.0 spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
tb_cms-1.2.0.beta3 spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb