From: Andrew Dolgov Date: Sat, 7 Feb 2009 07:22:15 +0000 (+0300) Subject: offline: schema fixes X-Git-Tag: 1.3.1~61 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=711f946160bf7c81e1fdeeea72275e3ba1f77af8;p=tt-rss.git offline: schema fixes --- diff --git a/offline.js b/offline.js index 742bf739..c21baa23 100644 --- a/offline.js +++ b/offline.js @@ -1,4 +1,4 @@ -var SCHEMA_VERSION = 9; +var SCHEMA_VERSION = 10; var offline_mode = false; var store = false; @@ -698,10 +698,8 @@ function offline_download_parse(stage, transport) { window.setTimeout("update_offline_data(0)", 1800*1000); debug("update_offline_data: finished"); - var date = new Date(); - var ts = Math.round(date.getTime() / 1000); - - db.execute("DELETE FROM articles WHERE added < ? - 2592000", [ts]); + db.execute("DELETE FROM articles WHERE "+ + "updated < DATETIME('NOW', 'localtime', '-31 days')"); } } @@ -952,7 +950,8 @@ function init_gears() { db.execute("CREATE TRIGGER IF NOT EXISTS articles_update_modified "+ "UPDATE OF unread ON articles "+ "BEGIN "+ - "UPDATE articles SET modified = DATETIME('NOW') WHERE id = old.id AND "+ + "UPDATE articles SET modified = DATETIME('NOW', 'localtime') "+ + "WHERE id = old.id AND "+ "old.unread = 1;"+ "END;");