fix: 确保数据目录和上传目录存在后再初始化数据库

This commit is contained in:
2026-05-03 13:40:16 +08:00
parent 63b3f9efb3
commit 730ad0d126
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -11,6 +11,7 @@ import (
"context"
"fmt"
"log"
"os"
"path/filepath"
"time"
"verification-platform-backend/internal/config"
@@ -52,6 +53,10 @@ func initDatabase() {
func initSQLite() {
dataDir := config.GetDataDir()
if err := os.MkdirAll(dataDir, 0755); err != nil {
log.Fatal("Failed to create data directory:", err.Error())
}
dbPath := filepath.Join(dataDir, "verification_platform.db")
var errOpen error