Sha256: db93eb79fbdd82a1ad98f21689191415b1936e3dfa1fe0974447752082f7439e

Contents?: true

Size: 679 Bytes

Versions: 5

Compression:

Stored size: 679 Bytes

Contents

class MoveLayoutFromNoCmsBlocksBlockTranslationsToNoCmsBlocksBlocks < ActiveRecord::Migration
  def up
    add_column :no_cms_blocks_blocks, :layout, :string

    NoCms::Blocks::Block::Translation.all.each do |translation|
      translation.globalized_model.update_column layout: translation.layout
    end

    remove_column :no_cms_blocks_block_translations, :layout, :string
  end

  def down
    add_column :no_cms_blocks_block_translations, :layout, :string
    NoCms::Blocks::Block::Translation.all.each do |translation|
      translation.update_column layout: translation.globalized_model.layout
    end
    remove_column :no_cms_blocks_blocks, :layout, :string
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nocms-blocks-1.2.0 db/migrate/20150710112549_move_layout_from_no_cms_blocks_block_translations_to_no_cms_blocks_blocks.rb
nocms-blocks-1.1.3 db/migrate/20150710112549_move_layout_from_no_cms_blocks_block_translations_to_no_cms_blocks_blocks.rb
nocms-blocks-1.1.2 db/migrate/20150710112549_move_layout_from_no_cms_blocks_block_translations_to_no_cms_blocks_blocks.rb
nocms-blocks-1.1.1 db/migrate/20150710112549_move_layout_from_no_cms_blocks_block_translations_to_no_cms_blocks_blocks.rb
nocms-blocks-1.1.0 db/migrate/20150710112549_move_layout_from_no_cms_blocks_block_translations_to_no_cms_blocks_blocks.rb