don't backup db for tests
This commit is contained in:
@@ -143,6 +143,7 @@ func main() {
|
|||||||
defer dbc.Close()
|
defer dbc.Close()
|
||||||
|
|
||||||
err = dbc.Migrate(db.MigrationContext{
|
err = dbc.Migrate(db.MigrationContext{
|
||||||
|
Production: true,
|
||||||
DBPath: *confDBPath,
|
DBPath: *confDBPath,
|
||||||
OriginalMusicPath: confMusicPaths[0].path,
|
OriginalMusicPath: confMusicPaths[0].path,
|
||||||
PlaylistsPath: *confPlaylistsPath,
|
PlaylistsPath: *confPlaylistsPath,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type MigrationContext struct {
|
type MigrationContext struct {
|
||||||
|
Production bool
|
||||||
DBPath string
|
DBPath string
|
||||||
OriginalMusicPath string
|
OriginalMusicPath string
|
||||||
PlaylistsPath string
|
PlaylistsPath string
|
||||||
@@ -721,5 +722,8 @@ func migratePlaylistsPaths(tx *gorm.DB, ctx MigrationContext) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func backupDBPre016(tx *gorm.DB, ctx MigrationContext) error {
|
func backupDBPre016(tx *gorm.DB, ctx MigrationContext) error {
|
||||||
|
if !ctx.Production {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return Dump(context.Background(), tx, fmt.Sprintf("%s.%d.bak", ctx.DBPath, time.Now().Unix()))
|
return Dump(context.Background(), tx, fmt.Sprintf("%s.%d.bak", ctx.DBPath, time.Now().Unix()))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user