refactor: refactoring of code
This commit is contained in:
@@ -154,11 +154,10 @@ func BackupDatabase(disableCompression bool, prune bool, keepLast int) {
|
||||
}
|
||||
utils.Done("Database has been backed up")
|
||||
|
||||
//Delete old backup
|
||||
if prune {
|
||||
deleteOldBackup(keepLast)
|
||||
}
|
||||
|
||||
}
|
||||
//Delete old backup
|
||||
if prune {
|
||||
deleteOldBackup(keepLast)
|
||||
}
|
||||
|
||||
historyFile, err := os.OpenFile(fmt.Sprintf("%s/history.txt", storagePath), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
@@ -191,7 +190,7 @@ func deleteOldBackup(keepLast int) {
|
||||
if err != nil {
|
||||
utils.Fatal("Error:", err)
|
||||
} else {
|
||||
utils.Done("File", filePath, "deleted successfully")
|
||||
utils.Done("File ", filePath, " deleted successfully")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package utils
|
||||
|
||||
const Notice = "Please remove --operation flag.\n" +
|
||||
"Use: \n" +
|
||||
"- backup for database backup operation [eg: bkup backup -d database_name ...]\n" +
|
||||
"- restore for database restore operation [eg. bkup restore -d database_name ...]\n" +
|
||||
"Example: bkup backup --storage s3 ...( instead of < bkup --operation backup >)\n" +
|
||||
"We are sorry for this inconvenient\n"
|
||||
const RestoreExample = "pg-bkup restore --dbname database --file db_20231219_022941.sql.gz\n" +
|
||||
"bkup restore --dbname database --storage s3 --path /custom-path --file db_20231219_022941.sql.gz"
|
||||
const BackupExample = "pg-bkup backup --dbname database --disable-compression\n" +
|
||||
|
||||
Reference in New Issue
Block a user