patched folder bug for users
All checks were successful
Build and Release Core / Test and Build (push) Successful in 4m28s
All checks were successful
Build and Release Core / Test and Build (push) Successful in 4m28s
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"epigas.gitea.cloud/RiskRancher/core/pkg/domain"
|
||||
@@ -18,9 +20,14 @@ var schemaSQL string
|
||||
//go:embed defaults/*.json
|
||||
var defaultAdaptersFS embed.FS
|
||||
|
||||
func InitDB(filepath string) *sql.DB {
|
||||
func InitDB(dbPath string) *sql.DB {
|
||||
|
||||
dsn := "file:" + filepath + "?_pragma=journal_mode(WAL)&_pragma=busy_timeout(5000)&_pragma=synchronous(NORMAL)&_pragma=foreign_keys(1)"
|
||||
dir := filepath.Dir(dbPath)
|
||||
|
||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||
log.Fatalf("Failed to create database directory: %v", err)
|
||||
}
|
||||
dsn := "file:" + dbPath + "?_pragma=journal_mode(WAL)&_pragma=busy_timeout(5000)&_pragma=synchronous(NORMAL)&_pragma=foreign_keys(1)"
|
||||
|
||||
db, err := sql.Open("sqlite", dsn)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user