This commit is contained in:
Liang Ding 2023-01-19 15:37:35 +08:00
parent 74ef94875b
commit 7401ae845a
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 8 additions and 4 deletions

View file

@ -353,14 +353,18 @@ func (box *Box) Remove(path string) error {
}
func (box *Box) Unindex() {
task.PrependTask(task.DatabaseIndex, unindex, box.ID)
}
func unindex(boxID string) {
tx, err := sql.BeginTx()
if nil != err {
return
}
sql.RemoveBoxHash(tx, box.ID)
sql.DeleteByBoxTx(tx, box.ID)
sql.RemoveBoxHash(tx, boxID)
sql.DeleteByBoxTx(tx, boxID)
sql.CommitTx(tx)
ids := treenode.RemoveBlockTreesByBoxID(box.ID)
ids := treenode.RemoveBlockTreesByBoxID(boxID)
RemoveRecentDoc(ids)
}