From ed106ab7c6cdef4d58616b41b3d96b28a7cde3eb Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Tue, 2 Dec 2014 15:33:29 +0900 Subject: [PATCH] Set createdAt only when a device is inserted for the first time. --- lib/db/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/db/api.js b/lib/db/api.js index 1b07c8c2..14075293 100644 --- a/lib/db/api.js +++ b/lib/db/api.js @@ -128,7 +128,6 @@ dbapi.saveDevice = function(serial, device) { , status: device.status , ready: false , statusChangedAt: r.now() - , createdAt: r.now() , lastHeartbeatAt: r.now() , reverseForwards: [] } @@ -136,6 +135,7 @@ dbapi.saveDevice = function(serial, device) { .then(function(stats) { if (stats.skipped) { data.serial = serial + data.createdAt = r.now() return db.run(r.table('devices').insert(data)) } return stats