Sha256: 775ed8cb49e45632bffa44a6c35df6a703931047f24d5a82455720411477ab01

Contents?: true

Size: 1.95 KB

Versions: 68

Compression:

Stored size: 1.95 KB

Contents

# This migration comes from bit_player (originally 20140620222851)
class BitPlayer::Tool < ActiveRecord::Base; end
class BitPlayer::ContentModule < ActiveRecord::Base; end
class BitPlayer::ContentProvider < ActiveRecord::Base; end
class BitPlayer::ContentProviders::SlideshowProvider < BitPlayer::ContentProvider; end

class ConvertToolsModulesPresentersToBitCore < ActiveRecord::Migration
  def up
    BitPlayer::Tool.all.each do |tool|
      BitCore::Tool.create!(
        id: tool.id,
        title: tool.title,
        position: tool.position
      )
    end
    BitPlayer::ContentModule.all.each do |mod|
      BitCore::ContentModule.create!(
        id: mod.id,
        title: mod.title,
        bit_core_tool_id: mod.bit_player_tool_id,
        position: mod.position
      )
    end
    BitCore::ContentProvider.reset_column_information
    BitCore::ContentProviders::SlideshowProvider.reset_column_information
    BitPlayer::ContentProvider.all.each do |pro|
      type = pro.type
      if type == "BitPlayer::ContentProviders::SlideshowProvider"
        type = "BitCore::ContentProviders::SlideshowProvider"
      end
      BitCore::ContentProvider.create!(
        id: pro.id,
        type: type,
        show_next_nav: (type == "BitCore::ContentProviders::SlideshowProvider" ? true : pro.show_nav_link?),
        source_content_type: (pro.source_content_type || "").gsub(/BitPlayer::Slideshow/, "BitCore::Slideshow"),
        source_content_id: pro.source_content_id,
        bit_core_content_module_id: pro.bit_player_content_module_id,
        position: pro.position
      )
    end
    execute <<-SQL
      ALTER TABLE bit_player_content_modules
        DROP CONSTRAINT IF EXISTS fk_content_modules_tools
    SQL
    execute <<-SQL
      ALTER TABLE bit_player_content_providers
        DROP CONSTRAINT IF EXISTS fk_content_providers_modules
    SQL
    drop_table :bit_player_tools
    drop_table :bit_player_content_modules
    drop_table :bit_player_content_providers
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.8 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.7 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.6 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.5 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.4 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.2 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.1 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.22.0 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.21.2 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.21.1 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.21.0 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.20.1 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.19.9 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.19.8 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.19.7 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.19.6 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.19.5 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.19.4 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb
think_feel_do_engine-3.19.3 db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb