mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
* fix database reset (#1076)
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/golang-migrate/migrate/v4/source"
|
||||
"github.com/jmoiron/sqlx"
|
||||
sqlite3 "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/stashapp/stash/pkg/logger"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
@@ -95,6 +96,17 @@ func Reset(databasePath string) error {
|
||||
return errors.New("Error removing database: " + err.Error())
|
||||
}
|
||||
|
||||
// remove the -shm, -wal files ( if they exist )
|
||||
walFiles := []string{databasePath + "-shm", databasePath + "-wal"}
|
||||
for _, wf := range walFiles {
|
||||
if exists, _ := utils.FileExists(wf); exists {
|
||||
err = os.Remove(wf)
|
||||
if err != nil {
|
||||
return errors.New("Error removing database: " + err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Initialize(databasePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user