Sha256: c8b1b1016b1be2efe454b334538e986bcdf3a5655c165b35c147bdea5b520130

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

class BitPlayer::Slideshow < ActiveRecord::Base; end
class BitPlayer::Slide < ActiveRecord::Base; end
class BitPlayer::VideoSlide < BitPlayer::Slide; end

class ConvertSlidesSlideshowsToBitCore < ActiveRecord::Migration
  def up
    BitPlayer::Slideshow.all.each do |slideshow|
      BitCore::Slideshow.create!(title: slideshow.title, id: slideshow.id)
    end
    BitPlayer::Slide.all.each do |slide|
      type = (slide.type || "").gsub(/BitPlayer::VideoSlide/, "BitCore::VideoSlide")
      BitCore::Slide.create!(
        title: slide.title,
        id: slide.id,
        body: slide.body,
        position: slide.position,
        bit_core_slideshow_id: slide.bit_player_slideshow_id,
        type: type,
        options: slide.options,
        is_title_visible: slide.is_title_visible
      )
    end
    execute <<-SQL
      ALTER TABLE bit_player_slides
        DROP CONSTRAINT IF EXISTS fk_slides_slideshows
    SQL

    execute <<-SQL
      ALTER TABLE bit_player_slides
        DROP CONSTRAINT IF EXISTS bit_player_slide_position
    SQL
    drop_table :bit_player_slides
    drop_table :bit_player_slideshows
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bit_player-0.4.10 db/migrate/20140620182756_convert_slides_slideshows_to_bit_core.rb
bit_player-0.4.9 db/migrate/20140620182756_convert_slides_slideshows_to_bit_core.rb
bit_player-0.5.0 db/migrate/20140620182756_convert_slides_slideshows_to_bit_core.rb
bit_player-0.4.4 db/migrate/20140620182756_convert_slides_slideshows_to_bit_core.rb
bit_player-0.4.3 db/migrate/20140620182756_convert_slides_slideshows_to_bit_core.rb
bit_player-0.4.2 db/migrate/20140620182756_convert_slides_slideshows_to_bit_core.rb
bit_player-0.4.1 db/migrate/20140620182756_convert_slides_slideshows_to_bit_core.rb