summaryrefslogtreecommitdiff
path: root/db/migrate/20090901095657_add_indices.rb
blob: 6dd54b2f66e77ff8139c20017e9d3613ec36473a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class AddIndices < ActiveRecord::Migration
  def self.up
    change_table :pages do |t|
      t.index :id
      t.index :node_id
      t.index :user_id
      t.index :revision
    end
    
    change_table :nodes do |t|
      t.index :id
      t.index :slug
      t.index :unique_name
      t.index :lft
      t.index :rgt
      t.index :parent_id
      t.index :head_id
      t.index :draft_id
      t.index :locking_user_id
    end
    
    change_table :page_translations do |t|
      t.index :locale
    end
  end

  def self.down
    change_table :pages do |t|
      t.remove_index :id
      t.remove_index :node_id
      t.remove_index :user_id
      t.remove_index :revision
    end
    
    change_table :nodes do |t|
      t.remove_index :id
      t.remove_index :slug
      t.remove_index :unique_name
      t.remove_index :lft
      t.remove_index :rgt
      t.remove_index :parent_id
      t.remove_index :head_id
      t.remove_index :draft_id
      t.remove_index :locking_user_id
    end
    
    change_table :page_translations do |t|
      t.remove_index :page_id
      t.remove_index :locale
    end
  end
end