Sha256: 471d6f8ee00c4d1e3f733ab2fe055d062d7e8e92795bec91a35a50181e3c3fc7

Contents?: true

Size: 669 Bytes

Versions: 7

Compression:

Stored size: 669 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
tb_cms-1.3.0 db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
tb_cms-1.3.beta1 db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
tb_cms-1.2.3 db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
tb_cms-1.2.2 db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
tb_cms-1.2.1 db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
tb_cms-1.2.0 db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
tb_cms-1.2.0.beta3 db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb