added date_modified to options as preparation for options syncing

This commit is contained in:
azivner
2017-10-29 16:14:59 -04:00
parent af13b28cab
commit afadd6ec06
6 changed files with 18 additions and 11 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ const sql = require('./sql');
const fs = require('fs-extra');
const log = require('./log');
const APP_DB_VERSION = 18;
const APP_DB_VERSION = 19;
const MIGRATIONS_DIR = "./migrations";
async function migrate() {
+3 -1
View File
@@ -44,7 +44,9 @@ async function getOption(optName) {
}
async function setOption(optName, optValue) {
await execute("UPDATE options SET opt_value = ? WHERE opt_name = ?", [optValue, optName]);
const now = utils.nowTimestamp();
await execute("UPDATE options SET opt_value = ?, date_modified = ? WHERE opt_name = ?", [optValue, now, optName]);
}
async function getSingleResult(query, params = []) {
+6 -6
View File
@@ -158,11 +158,11 @@ async function login() {
async function sync() {
const syncLog = [];
// if (syncInProgress) {
// syncLog.push("Sync already in progress");
//
// return syncLog;
// }
if (syncInProgress) {
syncLog.push("Sync already in progress");
return syncLog;
}
syncInProgress = true;
@@ -269,7 +269,7 @@ async function putNote(note, syncLog) {
}
}
if (SYNC_SERVER && false) {
if (SYNC_SERVER) {
log.info("Setting up sync");
setInterval(sync, 60000);