Truncate/trim server tables
This commit is contained in:
parent
4640b4a774
commit
67919892e8
5 changed files with 35 additions and 17 deletions
|
|
@ -42,12 +42,10 @@ exports.machineEvent = function machineEvent (rec) {
|
|||
const values = [rec.id, rec.deviceId, rec.eventType, rec.note, rec.deviceTime]
|
||||
|
||||
const deleteSql = `delete from machine_events
|
||||
where device_id=$1
|
||||
and event_type=$2
|
||||
and created < now() - interval '2 days'`
|
||||
where created < now() - interval '1 days'`
|
||||
|
||||
return db.none(sql, values)
|
||||
.then(() => db.none(deleteSql, [rec.deviceId, rec.eventType]))
|
||||
.then(() => db.none(deleteSql))
|
||||
}
|
||||
|
||||
exports.machineEvents = function machineEvents () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue