Sha256: fc168a504cd7183fc551e99e7bd0a8b0161daf335ff439beeeca3aa9c9066247
Contents?: true
Size: 334 Bytes
Versions: 23
Compression:
Stored size: 334 Bytes
Contents
class AddPositionToItems < ActiveRecord::Migration def change add_column :items, :position, :integer Item.order('id desc').each.with_index do |item, position| item.update_attribute :position, position end change_column :items, :position, :integer, :null => false add_index :items, [:position] end end
Version data entries
23 entries across 8 versions & 1 rubygems