1 class ChangeStickyToInteger < ActiveRecord::Migration
2 class Topic < ActiveRecord::Base; end
4 sticky_topics = Topic.find_all_by_sticky(true).collect &:id
5 change_column :topics, :sticky, :integer, :default => 0
6 Topic.update_all 'sticky=1', ['id in (?)', sticky_topics]
10 change_column :topics, :sticky, :boolean, :default => false