Commit 0d240c01b73984b61922c12d192a52b41eaf8e55

Authored by Luke Baker
1 parent d90fe8cd

update an index on appearances by add / del

add index on appearances (question_id, voter_id)
remove index on appearances (question_id) as it is now superseded by
the former
db/migrate/20110120202304_add_voter_id_index_on_appearances.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class AddVoterIdIndexOnAppearances < ActiveRecord::Migration
  2 + def self.up
  3 + add_index :appearances, [:question_id, :voter_id], :name => 'index_appearances_on_question_id_voter_id'
  4 + end
  5 +
  6 + def self.down
  7 + remove_index :appearances, :name => :index_appearances_on_question_id_voter_id
  8 + end
  9 +end
... ...
db/migrate/20110120204933_remove_question_id_index_on_appearances.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class RemoveQuestionIdIndexOnAppearances < ActiveRecord::Migration
  2 + def self.up
  3 + remove_index :appearances, :question_id
  4 + end
  5 +
  6 + def self.down
  7 + add_index :appearances, :question_id
  8 + end
  9 +end
... ...
db/schema.rb
... ... @@ -9,7 +9,7 @@
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11  
12   -ActiveRecord::Schema.define(:version => 20110119165820) do
  12 +ActiveRecord::Schema.define(:version => 20110120204933) do
13 13  
14 14 create_table "appearances", :force => true do |t|
15 15 t.integer "voter_id"
... ... @@ -26,7 +26,7 @@ ActiveRecord::Schema.define(:version =&gt; 20110119165820) do
26 26 end
27 27  
28 28 add_index "appearances", ["lookup"], :name => "index_appearances_on_lookup"
29   - add_index "appearances", ["question_id"], :name => "index_appearances_on_question_id"
  29 + add_index "appearances", ["question_id", "voter_id"], :name => "index_appearances_on_question_id_voter_id"
30 30  
31 31 create_table "choices", :force => true do |t|
32 32 t.integer "item_id"
... ...