diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-01-10 07:32:44 +0000 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-01-10 07:32:44 +0000 |
commit | 5e48e9204b5cb990cba7e7f6a12f0387e097d046 (patch) | |
tree | 027790b9c6b5bd25cb6f45ceba2d425acb77cd3f | |
parent | 181470323bb70aeb5d481f02aeec48245c283242 (diff) |
Use correct column type for sent_at date (was only preserving time and not date, resulting in incoming_messages all apparently being sent on January 1, 2000)
-rw-r--r-- | db/migrate/109_change_sent_at_to_datetime.rb | 12 | ||||
-rw-r--r-- | spec/models/incoming_message_spec.rb | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/db/migrate/109_change_sent_at_to_datetime.rb b/db/migrate/109_change_sent_at_to_datetime.rb new file mode 100644 index 000000000..5fc9b29ae --- /dev/null +++ b/db/migrate/109_change_sent_at_to_datetime.rb @@ -0,0 +1,12 @@ +class ChangeSentAtToDatetime < ActiveRecord::Migration + def self.up + remove_column :incoming_messages, :sent_at + add_column :incoming_messages, :sent_at, :timestamp + ActiveRecord::Base.connection.execute("update incoming_messages set last_parsed = null") + end + + def self.down + remove_column :incoming_messages, :sent_at + add_column :incoming_messages, :sent_at, :time + end +end diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index f514d6546..7808ef24c 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -14,6 +14,8 @@ describe IncomingMessage, " when dealing with incoming mail" do end it "should return the mail Date header date for sent at" do + @im.parse_raw_email!(true) + @im.reload @im.sent_at.should == @im.mail.date end |