Sha256: 24b33b85e9d0b8804f002724a2fc3ae475e5b16da1a6b7824800efd30b6be7a4

Contents?: true

Size: 402 Bytes

Versions: 2

Compression:

Stored size: 402 Bytes

Contents

class AddContentsCounterCacheToImages < ActiveRecord::Migration

  def up
    add_column :ckeditor_assets, :contents_count, :integer, default: 0
    Ckeditor::Picture.reset_column_information
    Ckeditor::Picture.find_each do |u|
      Ckeditor::Picture.update_counters u.id, :contents_count => u.contents.length
    end
  end

  def down
    remove_column :ckeditor_assets, :contents_count
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
georgia-0.7.1 lib/generators/georgia/upgrade/templates/add_contents_counter_cache_to_images.rb
georgia-0.7.0 lib/generators/georgia/upgrade/templates/add_contents_counter_cache_to_images.rb