Commit 64dd2e0fd62f8f2ca074dc351964a571fb807f69

Authored by Antonio Terceiro
1 parent a2571ba9

Creating indexes before removing records

db/migrate/20100928000952_aggressive_indexing_strategy2.rb
1 class AggressiveIndexingStrategy2 < ActiveRecord::Migration 1 class AggressiveIndexingStrategy2 < ActiveRecord::Migration
2 def self.up 2 def self.up
  3 + add_index(:action_tracker_notifications, :profile_id)
  4 + add_index(:action_tracker_notifications, :action_tracker_id)
3 5
4 say 'Removing duplicate notification records ...' 6 say 'Removing duplicate notification records ...'
5 buffer = '' 7 buffer = ''
@@ -29,8 +31,6 @@ class AggressiveIndexingStrategy2 &lt; ActiveRecord::Migration @@ -29,8 +31,6 @@ class AggressiveIndexingStrategy2 &lt; ActiveRecord::Migration
29 execute buffer 31 execute buffer
30 end 32 end
31 33
32 - add_index(:action_tracker_notifications, :profile_id)  
33 - add_index(:action_tracker_notifications, :action_tracker_id)  
34 add_index(:action_tracker_notifications, [:profile_id, :action_tracker_id], :unique => true) 34 add_index(:action_tracker_notifications, [:profile_id, :action_tracker_id], :unique => true)
35 end 35 end
36 36