1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-03 17:59:28 +02:00

Set createdAt only when a device is inserted for the first time.

This commit is contained in:
Simo Kinnunen 2014-12-02 15:33:29 +09:00
parent 34bf8adb99
commit ed106ab7c6

View file

@ -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