Commit a2d4cad818286c429c6a27e0c936106969cd431d

Authored by Pius Uzamere
1 parent 5429d2f0

schema changes to support fast presentation of results

db/migrate/20100128031315_add_question_id_to_items.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class AddQuestionIdToItems < ActiveRecord::Migration
  2 + def self.up
  3 + add_column :items, :question_id, :integer
  4 + end
  5 +
  6 + def self.down
  7 + remove_column :items, :question_id
  8 + end
  9 +end
... ...
db/migrate/20100128031509_add_data_to_choices.rb 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +class AddDataToChoices < ActiveRecord::Migration
  2 + def self.up
  3 + add_column :choices, :data, :string
  4 + puts "copying existing item data into associated choices ..."
  5 + Choice.all.each {|c| c.data = c.item.data; c.save!}
  6 + end
  7 +
  8 + def self.down
  9 + remove_column :choices, :data
  10 + end
  11 +end
... ...