don't delete oldrevs when cleaning meta

master
Ted Unangst 5 years ago
parent 035822f3f2
commit 8af2bbe746

@ -342,6 +342,16 @@ func saveextras(h *Honk) error {
return err return err
} }
} }
if p := h.Time; p != nil {
j, err := jsonify(p)
if err != nil {
_, err = stmtSaveMeta.Exec(h.ID, "time", j)
}
if err != nil {
log.Printf("error saving time: %s", err)
return err
}
}
return nil return nil
} }
@ -355,7 +365,7 @@ func deleteextras(honkid int64) {
if err != nil { if err != nil {
log.Printf("error deleting: %s", err) log.Printf("error deleting: %s", err)
} }
_, err = stmtDeleteMeta.Exec(honkid) _, err = stmtDeleteMeta.Exec(honkid, "oldrev")
if err != nil { if err != nil {
log.Printf("error deleting: %s", err) log.Printf("error deleting: %s", err)
} }
@ -519,7 +529,7 @@ func prepareStatements(db *sql.DB) {
stmtHonksByOntology = preparetodie(db, selecthonks+"join onts on honks.honkid = onts.honkid where onts.ontology = ? and (honks.userid = ? or (? = -1 and honks.whofore = 2))"+limit) stmtHonksByOntology = preparetodie(db, selecthonks+"join onts on honks.honkid = onts.honkid where onts.ontology = ? and (honks.userid = ? or (? = -1 and honks.whofore = 2))"+limit)
stmtSaveMeta = preparetodie(db, "insert into honkmeta (honkid, genus, json) values (?, ?, ?)") stmtSaveMeta = preparetodie(db, "insert into honkmeta (honkid, genus, json) values (?, ?, ?)")
stmtDeleteMeta = preparetodie(db, "delete from honkmeta where honkid = ?") stmtDeleteMeta = preparetodie(db, "delete from honkmeta where honkid = ? and genus <> ?")
stmtSaveHonk = preparetodie(db, "insert into honks (userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") stmtSaveHonk = preparetodie(db, "insert into honks (userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
stmtDeleteHonk = preparetodie(db, "delete from honks where honkid = ?") stmtDeleteHonk = preparetodie(db, "delete from honks where honkid = ?")
stmtUpdateHonk = preparetodie(db, "update honks set precis = ?, noise = ?, format = ?, dt = ? where honkid = ?") stmtUpdateHonk = preparetodie(db, "update honks set precis = ?, noise = ?, format = ?, dt = ? where honkid = ?")

Loading…
Cancel
Save