Sha256: 680494854a1632d3fabed537eb6bbc3730a316aa8124d1ece2976a94de47e043

Contents?: true

Size: 283 Bytes

Versions: 11

Compression:

Stored size: 283 Bytes

Contents

class AddPositionToImages < ActiveRecord::Migration
  def self.up
    add_column :images, :position, :integer
    
    Image.all.each_with_index do |image, i|
      image.update_attribute('position', i+1)
    end
  end

  def self.down
    remove_column :images, :position
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
radiant-images-extension-0.6.1 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.6.0 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.5.0 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.4.4 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.4.1 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.4.0 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.3.4 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.3.3 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.3.2 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.1.1 db/migrate/20100602044124_add_position_to_images.rb
radiant-images-extension-0.1.0 db/migrate/20100602044124_add_position_to_images.rb