mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
🎨 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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user