Sha256: ab9e4c8c05c2d107bee6d03e22b1a8e8d8d544064a328f37040ec7c588708488

Contents?: true

Size: 948 Bytes

Versions: 5

Compression:

Stored size: 948 Bytes

Contents

# This migration comes from pulitzer (originally 20151113183344)
class AddPostTypeContentElementAttributesToContentElements < ActiveRecord::Migration
  def up
    add_column :pulitzer_content_elements, :text_editor, :string
    add_column :pulitzer_content_elements, :height, :integer, default: 100
    add_column :pulitzer_content_elements, :width, :integer, default: 100
    add_column :pulitzer_content_elements, :sort_order, :integer
    Pulitzer::ContentElement.reset_column_information
    Pulitzer::ContentElement.find_each do |ce|
      if ptce = ce.post_type_content_element_type
        ce.update(text_editor: ptce.text_editor, height: ptce.height, width: ptce.width)
      end
    end
  end

  def down
    remove_column :pulitzer_content_elements, :text_editor
    remove_column :pulitzer_content_elements, :height
    remove_column :pulitzer_content_elements, :width
    remove_column :pulitzer_content_elements, :sort_order
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pulitzer-0.1.7 test/dummy/db/migrate/20151113220908_add_post_type_content_element_attributes_to_content_elements.pulitzer.rb
pulitzer-0.1.6 test/dummy/db/migrate/20151113220908_add_post_type_content_element_attributes_to_content_elements.pulitzer.rb
pulitzer-0.1.5 test/dummy/db/migrate/20151113220908_add_post_type_content_element_attributes_to_content_elements.pulitzer.rb
pulitzer-0.1.4 test/dummy/db/migrate/20151113220908_add_post_type_content_element_attributes_to_content_elements.pulitzer.rb
pulitzer-0.1.3 test/dummy/db/migrate/20151113220908_add_post_type_content_element_attributes_to_content_elements.pulitzer.rb