mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Add backup directory path setting (#2953)
* add backup directory path setting * Don't default backup path * handle migration backup path input when given filename or path Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -253,8 +254,14 @@ func (db *Database) DatabasePath() string {
|
||||
return db.dbPath
|
||||
}
|
||||
|
||||
func (db *Database) DatabaseBackupPath() string {
|
||||
return fmt.Sprintf("%s.%d.%s", db.dbPath, db.schemaVersion, time.Now().Format("20060102_150405"))
|
||||
func (db *Database) DatabaseBackupPath(backupDirectoryPath string) string {
|
||||
fn := fmt.Sprintf("%s.%d.%s", db.dbPath, db.schemaVersion, time.Now().Format("20060102_150405"))
|
||||
|
||||
if backupDirectoryPath != "" {
|
||||
return filepath.Join(backupDirectoryPath, fn)
|
||||
}
|
||||
|
||||
return fn
|
||||
}
|
||||
|
||||
func (db *Database) Version() uint {
|
||||
|
||||
Reference in New Issue
Block a user