blob: fe74507736f027210c4cae9b2d26740ad3615693 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
class CreateInfoRequestEvents < ActiveRecord::Migration
def self.up
create_table :info_request_events do |t|
t.column "info_request_id", :integer
t.column :event_type, :text
t.column :params_yaml, :text
t.column :created_at, :datetime
end
# Create the missing events for requests already sent
InfoRequest.find(:all).each do |info_request|
info_request_event = InfoRequestEvent.new
info_request_event.event_type = 'sent'
info_request_event.params = { :email => info_request.recipient_email, :outgoing_message_id => info_request.outgoing_messages[0].id }
info_request_event.info_request = info_request
info_request_event.created_at = info_request.outgoing_messages[0].sent_at
info_request_event.save!
end
end
def self.down
drop_table :info_request_events
end
end
|