mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-04-30 07:10:20 -05:00
🎨 文档重命名后变更文档更新时间 Fix https://github.com/siyuan-note/siyuan/issues/5792
This commit is contained in:
+10
-7
@@ -18,6 +18,8 @@ package sql
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/siyuan-note/siyuan/kernel/cache"
|
||||
)
|
||||
|
||||
type Block struct {
|
||||
@@ -44,20 +46,21 @@ type Block struct {
|
||||
Updated string
|
||||
}
|
||||
|
||||
func updateRootContent(tx *sql.Tx, content, id string) {
|
||||
stmt := "UPDATE blocks SET content = ?, fcontent = ? WHERE id = ?"
|
||||
if err := execStmtTx(tx, stmt, content, content, id); nil != err {
|
||||
func updateRootContent(tx *sql.Tx, content, updated, id string) {
|
||||
stmt := "UPDATE blocks SET content = ?, fcontent = ?, updated = ? WHERE id = ?"
|
||||
if err := execStmtTx(tx, stmt, content, content, updated, id); nil != err {
|
||||
return
|
||||
}
|
||||
stmt = "UPDATE blocks_fts SET content = ?, fcontent = ? WHERE id = ?"
|
||||
if err := execStmtTx(tx, stmt, content, content, id); nil != err {
|
||||
stmt = "UPDATE blocks_fts SET content = ?, fcontent = ?, updated = ? WHERE id = ?"
|
||||
if err := execStmtTx(tx, stmt, content, content, updated, id); nil != err {
|
||||
return
|
||||
}
|
||||
stmt = "UPDATE blocks_fts_case_insensitive SET content = ?, fcontent = ? WHERE id = ?"
|
||||
if err := execStmtTx(tx, stmt, content, content, id); nil != err {
|
||||
stmt = "UPDATE blocks_fts_case_insensitive SET content = ?, fcontent = ?, updated = ? WHERE id = ?"
|
||||
if err := execStmtTx(tx, stmt, content, content, updated, id); nil != err {
|
||||
return
|
||||
}
|
||||
removeBlockCache(id)
|
||||
cache.RemoveBlockIAL(id)
|
||||
}
|
||||
|
||||
func InsertBlock(tx *sql.Tx, block *Block) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user