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 / .svn / pristine / 1d / 1d4501e489efd6d8ed1d23023b3b3b28fa284bd3.svn-base @ 1297:0a574315af3e

History | View | Annotate | Download (552 Bytes)

1
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

    
8
    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