mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 文档重命名后变更文档更新时间 Fix https://github.com/siyuan-note/siyuan/issues/5792
This commit is contained in:
parent
078ea5c793
commit
a09e201f99
2 changed files with 24 additions and 16 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue