]> git.wh0rd.org Git - tt-rss.git/commitdiff
offline: schema fixes
authorAndrew Dolgov <fox@bah.org.ru>
Sat, 7 Feb 2009 07:22:15 +0000 (10:22 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Sat, 7 Feb 2009 07:22:15 +0000 (10:22 +0300)
offline.js

index 742bf739211fe28ad5f8a599207b3c8cd866b7d2..c21baa23de76ea1beaf75af9ef499166d2cb2ec2 100644 (file)
@@ -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;");