Commit ca5f7aca912b2548ff0457d964cf93c9bcea5a7b
1 parent
ac6d2493
Exists in
master
and in
1 other branch
Fix migration error that will cause first time migrate to fail
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
db/migrate/20100517153944_add_missing_response_time_exp_to_votes.rb
@@ -3,7 +3,11 @@ class AddMissingResponseTimeExpToVotes < ActiveRecord::Migration | @@ -3,7 +3,11 @@ class AddMissingResponseTimeExpToVotes < ActiveRecord::Migration | ||
3 | add_column :votes, :missing_response_time_exp, :string, :default => "" | 3 | add_column :votes, :missing_response_time_exp, :string, :default => "" |
4 | add_column :skips, :missing_response_time_exp, :string, :default => "" | 4 | add_column :skips, :missing_response_time_exp, :string, :default => "" |
5 | 5 | ||
6 | + begin | ||
6 | recording_client_time_start_date = Vote.find(:all, :conditions => 'time_viewed IS NOT NULL', :order => 'created_at', :limit => 1).first.created_at | 7 | recording_client_time_start_date = Vote.find(:all, :conditions => 'time_viewed IS NOT NULL', :order => 'created_at', :limit => 1).first.created_at |
8 | + rescue | ||
9 | + recording_client_time_start_date = nil | ||
10 | + end | ||
7 | Vote.find_each do |v| | 11 | Vote.find_each do |v| |
8 | if v.created_at <= recording_client_time_start_date && v.time_viewed.nil? | 12 | if v.created_at <= recording_client_time_start_date && v.time_viewed.nil? |
9 | v.missing_response_time_exp = "missing" | 13 | v.missing_response_time_exp = "missing" |