diff --git a/internal/db/DB.go b/internal/db/DB.go index 658820a..0e852a5 100644 --- a/internal/db/DB.go +++ b/internal/db/DB.go @@ -8,7 +8,6 @@ package db import ( "fmt" - "os" "time" "gorm.io/driver/sqlite" @@ -34,19 +33,19 @@ func Connect(dbpath string) (*gorm.DB, error) { // safe: SQLite treats absent WAL/SHM files as a clean slate and will // recreate them. We only do this if the main DB file already exists // (i.e. this is not a first-run) to avoid masking legitimate errors. - if _, err := os.Stat(dbpath); err == nil { - for _, ext := range []string{"-wal", "-shm"} { - artefact := dbpath + ext - if _, err := os.Stat(artefact); err == nil { - if removeErr := os.Remove(artefact); removeErr != nil { - // Non-fatal: log and continue — SQLite may still recover. - fmt.Printf("[DB] warning: could not remove stale %s: %v\n", ext, removeErr) - } else { - fmt.Printf("[DB] removed stale lock artefact: %s\n", artefact) - } - } - } - } + // if _, err := os.Stat(dbpath); err == nil { + // for _, ext := range []string{"-wal", "-shm"} { + // artefact := dbpath + ext + // if _, err := os.Stat(artefact); err == nil { + // if removeErr := os.Remove(artefact); removeErr != nil { + // // Non-fatal: log and continue — SQLite may still recover. + // fmt.Printf("[DB] warning: could not remove stale %s: %v\n", ext, removeErr) + // } else { + // fmt.Printf("[DB] removed stale lock artefact: %s\n", artefact) + // } + // } + // } + // } // ── Connection with retry ───────────────────────────────────────────── // Even after removing WAL/SHM, the main DB file itself may still be