To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / db / migrate / 20100313132032_add_issues_nested_sets_columns.rb @ 912:5e80956cc792

History | View | Annotate | Download (552 Bytes)

1 0:513646585e45 Chris
class AddIssuesNestedSetsColumns < ActiveRecord::Migration
2
  def self.up
3
    add_column :issues, :parent_id, :integer, :default => nil
4
    add_column :issues, :root_id, :integer, :default => nil
5
    add_column :issues, :lft, :integer, :default => nil
6
    add_column :issues, :rgt, :integer, :default => nil
7 909:cbb26bc654de Chris
8 0:513646585e45 Chris
    Issue.update_all("parent_id = NULL, root_id = id, lft = 1, rgt = 2")
9
  end
10
11
  def self.down
12
    remove_column :issues, :parent_id
13
    remove_column :issues, :root_id
14
    remove_column :issues, :lft
15
    remove_column :issues, :rgt
16
  end
17
end