From d5ae1a30e1deae06f2f28b76b7449cc5c3f7cd08 Mon Sep 17 00:00:00 2001 From: smail Date: Tue, 22 Sep 2026 03:54:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E7=B4=A7SQLite=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/services/dbmigration/portable_executor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/services/dbmigration/portable_executor.go b/backend/services/dbmigration/portable_executor.go index 6435623..6483280 100644 --- a/backend/services/dbmigration/portable_executor.go +++ b/backend/services/dbmigration/portable_executor.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "errors" - "os" "strings" "sync" "sync/atomic" @@ -12,6 +11,7 @@ import ( "git.pcux.cn/xuans/Smail/config" "git.pcux.cn/xuans/Smail/db/migration" + securefile "git.pcux.cn/xuans/Smail/utils/file" ) // PortableExecutor 使用版本化目标结构复制业务数据,不拼接用户提供的 SQL。 @@ -108,7 +108,7 @@ func (e *PortableExecutor) createTarget(ctx context.Context, target config.Datab if err != nil { return nil, err } - file, err := os.OpenFile(path, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0600) + file, err := securefile.CreateExclusiveFile(path, 0600) if err != nil { return nil, ErrTargetExists }