You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
wikiufc/db/migrate/023_wiki_page_order.rb

17 lines
361 B

class WikiPageOrder < ActiveRecord::Migration
def self.up
add_column :wiki_pages, :position, :integer
add_column :wiki_page_versions, :position, :integer
Course.find(:all).each do |course|
course.wiki_pages.each_with_index do |wp, i|
wp.position = i+1
wp.save!
end
end
end
def self.down
remove_column :wiki_pages, :position
end
end