🎨 Delete the corresponding data in the database attributes table after deleting the doc https://github.com/siyuan-note/siyuan/issues/9875
This commit is contained in:
parent
a807d0c2c5
commit
d2c0c26252
1 changed files with 12 additions and 0 deletions
|
@ -1122,6 +1122,10 @@ func deleteByRootID(tx *sql.Tx, rootID string, context map[string]interface{}) (
|
|||
if err = execStmtTx(tx, stmt, rootID); nil != err {
|
||||
return
|
||||
}
|
||||
stmt = "DELETE FROM attributes WHERE root_id = ?"
|
||||
if err = execStmtTx(tx, stmt, rootID); nil != err {
|
||||
return
|
||||
}
|
||||
ClearCache()
|
||||
eventbus.Publish(eventbus.EvtSQLDeleteBlocks, context, rootID)
|
||||
return
|
||||
|
@ -1160,6 +1164,10 @@ func batchDeleteByRootIDs(tx *sql.Tx, rootIDs []string, context map[string]inter
|
|||
if err = execStmtTx(tx, stmt); nil != err {
|
||||
return
|
||||
}
|
||||
stmt = "DELETE FROM attributes WHERE root_id IN " + ids
|
||||
if err = execStmtTx(tx, stmt); nil != err {
|
||||
return
|
||||
}
|
||||
ClearCache()
|
||||
eventbus.Publish(eventbus.EvtSQLDeleteBlocks, context, fmt.Sprintf("%d", len(rootIDs)))
|
||||
return
|
||||
|
@ -1196,6 +1204,10 @@ func batchDeleteByPathPrefix(tx *sql.Tx, boxID, pathPrefix string) (err error) {
|
|||
if err = execStmtTx(tx, stmt, boxID, pathPrefix+"%"); nil != err {
|
||||
return
|
||||
}
|
||||
stmt = "DELETE FROM attributes WHERE box = ? AND path LIKE ?"
|
||||
if err = execStmtTx(tx, stmt, boxID, pathPrefix+"%"); nil != err {
|
||||
return
|
||||
}
|
||||
ClearCache()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue