diff --git a/db/migrate/20091204151448_add_prompts_count_to_choices.rb b/db/migrate/20091204151448_add_prompts_count_to_choices.rb new file mode 100644 index 0000000..75a9c2d --- /dev/null +++ b/db/migrate/20091204151448_add_prompts_count_to_choices.rb @@ -0,0 +1,14 @@ +class AddPromptsCountToChoices < ActiveRecord::Migration + def self.up + add_column :choices, :prompts_count, :integer, :default => 0 + + Choice.reset_column_information + Choice.find(:all).each do |c| + Choice.update_counters c.id, :prompts_count => c.prompts_on_the_left_count + c.prompts_on_the_right_count + end + end + + def self.down + remove_column :choices, :prompts_count + end +end -- libgit2 0.21.2