make sure we don't zap our own files
This commit is contained in:
parent
233f80fa4a
commit
e05c112af4
2
honk.go
2
honk.go
|
@ -1316,7 +1316,7 @@ func cleanupdb() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expdate := time.Now().UTC().Add(-30 * 24 * time.Hour).Format(dbtimeformat)
|
expdate := time.Now().UTC().Add(-30 * 24 * time.Hour).Format(dbtimeformat)
|
||||||
doordie(db, "update files set content = '', local = 0 where length(content) > 20000 and fileid in (select fileid from donks join honks on donks.honkid = honks.honkid where honks.dt < ? and whofore = 0)", expdate)
|
doordie(db, "update files set content = '', local = 0 where length(content) > 20000 and fileid in (select fileid from donks join honks on donks.honkid = honks.honkid where honks.dt < ? and whofore = 0) and fileid not in (select fileid from donks join honks on donks.honkid = honks.honkid where whofore = 2)", expdate)
|
||||||
doordie(db, "delete from files where fileid not in (select fileid from donks)")
|
doordie(db, "delete from files where fileid not in (select fileid from donks)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue