Merge pull request #4422 from steinwaywhw/patch-2

Fix SQLite datetime issues
This commit is contained in:
Robin Ward 2016-08-26 13:07:39 -04:00 committed by GitHub
commit 6036770c0d

View file

@ -100,7 +100,7 @@ class ImportScripts::Mbox < ImportScripts::Base
db = open_db db = open_db
db.execute "UPDATE emails SET reply_to = null WHERE reply_to = ''" db.execute "UPDATE emails SET reply_to = null WHERE reply_to = ''"
rows = db.execute "SELECT msg_id, title, reply_to FROM emails ORDER BY email_date ASC" rows = db.execute "SELECT msg_id, title, reply_to FROM emails ORDER BY datetime(email_date) ASC"
msg_ids = {} msg_ids = {}
titles = {} titles = {}
@ -199,6 +199,7 @@ class ImportScripts::Mbox < ImportScripts::Base
title = clean_title(mail['Subject'].to_s) title = clean_title(mail['Subject'].to_s)
reply_to = mail['In-Reply-To'].to_s reply_to = mail['In-Reply-To'].to_s
email_date = mail['date'].to_s email_date = mail['date'].to_s
email_date = DateTime.parse(email_date).to_s unless email_date.blank?
db.execute "INSERT OR IGNORE INTO emails (msg_id, db.execute "INSERT OR IGNORE INTO emails (msg_id,
from_email, from_email,