Sha256: 9a786783be23aae8e35cafcb0625941046c14153c801f671bfdff86212fadf9d

Contents?: true

Size: 948 Bytes

Versions: 7

Compression:

Stored size: 948 Bytes

Contents

class ChangeIsCommentToItemType < ActiveRecord::Migration
  def change
      add_column :inkwell_blog_items, :item_type, :string
      ::Inkwell::BlogItem.where(:is_comment => true).update_all(:item_type => 'c')
      ::Inkwell::BlogItem.where(:is_comment => false).update_all(:item_type => 'p')
      remove_column :inkwell_blog_items, :is_comment

      add_column :inkwell_favorite_items, :item_type, :string
      ::Inkwell::FavoriteItem.where(:is_comment => true).update_all(:item_type => 'c')
      ::Inkwell::FavoriteItem.where(:is_comment => false).update_all(:item_type => 'p')
      remove_column :inkwell_favorite_items, :is_comment

      add_column :inkwell_timeline_items, :item_type, :string
      ::Inkwell::TimelineItem.where(:is_comment => true).update_all(:item_type => 'c')
      ::Inkwell::TimelineItem.where(:is_comment => false).update_all(:item_type => 'p')
      remove_column :inkwell_timeline_items, :is_comment
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
inkwell-2.0.0 db/migrate/20130202130030_change_is_comment_to_item_type.rb
inkwell-1.5.2 db/migrate/20130202130030_change_is_comment_to_item_type.rb
inkwell-1.5.1 db/migrate/20130202130030_change_is_comment_to_item_type.rb
inkwell-1.4.1 db/migrate/20130202130030_change_is_comment_to_item_type.rb
inkwell-1.2.0 db/migrate/20130202130030_change_is_comment_to_item_type.rb
inkwell-1.1.7 db/migrate/20130202130030_change_is_comment_to_item_type.rb
inkwell-1.1.1 db/migrate/20130202130030_change_is_comment_to_item_type.rb