mirror of
https://github.com/stashapp/stash.git
synced 2025-12-15 04:44:28 +01:00
* fix database reset (#1076)
This commit is contained in:
parent
3b41894dbd
commit
088f32a116
1 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue