diff options
| author | hukl <contact@smyck.org> | 2009-09-01 12:04:58 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-01 12:04:58 +0200 |
| commit | b3a5a2acbf904379928adb83e7789384c859c3f8 (patch) | |
| tree | 02e8663974aceb9a9cf7ee847c20f3fe86da9fda /db/migrate | |
| parent | 4aa4a0e4a44735d22ac7f8fd1b12b19699af087b (diff) | |
added migration to add indices on several heavy duty columns. totally unrelated but huge performance win ;)
Diffstat (limited to 'db/migrate')
| -rw-r--r-- | db/migrate/20090901095657_add_indices.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/db/migrate/20090901095657_add_indices.rb b/db/migrate/20090901095657_add_indices.rb new file mode 100644 index 0000000..dd31046 --- /dev/null +++ b/db/migrate/20090901095657_add_indices.rb | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | class AddIndices < ActiveRecord::Migration | ||
| 2 | def self.up | ||
| 3 | change_table :pages do |t| | ||
| 4 | t.index :id | ||
| 5 | t.index :node_id | ||
| 6 | t.index :user_id | ||
| 7 | t.index :revision | ||
| 8 | end | ||
| 9 | |||
| 10 | change_table :nodes do |t| | ||
| 11 | t.index :id | ||
| 12 | t.index :slug | ||
| 13 | t.index :unique_name | ||
| 14 | t.index :lft | ||
| 15 | t.index :rgt | ||
| 16 | t.index :parent_id | ||
| 17 | t.index :head_id | ||
| 18 | t.index :draft_id | ||
| 19 | t.index :locking_user_id | ||
| 20 | end | ||
| 21 | |||
| 22 | change_table :page_translations do |t| | ||
| 23 | t.index :page_id | ||
| 24 | t.index :locale | ||
| 25 | end | ||
| 26 | end | ||
| 27 | |||
| 28 | def self.down | ||
| 29 | change_table :pages do |t| | ||
| 30 | t.remove_index :id | ||
| 31 | t.remove_index :node_id | ||
| 32 | t.remove_index :user_id | ||
| 33 | t.remove_index :revision | ||
| 34 | end | ||
| 35 | |||
| 36 | change_table :nodes do |t| | ||
| 37 | t.remove_index :id | ||
| 38 | t.remove_index :slug | ||
| 39 | t.remove_index :unique_name | ||
| 40 | t.remove_index :lft | ||
| 41 | t.remove_index :rgt | ||
| 42 | t.remove_index :parent_id | ||
| 43 | t.remove_index :head_id | ||
| 44 | t.remove_index :draft_id | ||
| 45 | t.remove_index :locking_user_id | ||
| 46 | end | ||
| 47 | |||
| 48 | change_table :page_translations do |t| | ||
| 49 | t.remove_index :page_id | ||
| 50 | t.remove_index :locale | ||
| 51 | end | ||
| 52 | end | ||
| 53 | end | ||
