refactor: Remove unnecessary code in DatabaseBackupJob and BackupExecutions
This commit is contained in:
parent
1a232b9b10
commit
cb39544808
2 changed files with 4 additions and 4 deletions
|
|
@ -101,7 +101,7 @@ public function handle(): void
|
|||
}
|
||||
|
||||
BackupCreated::dispatch($this->team->id);
|
||||
|
||||
|
||||
$status = str(data_get($this->database, 'status'));
|
||||
if (! $status->startsWith('running') && $this->database->id !== 0) {
|
||||
ray('database not running');
|
||||
|
|
@ -391,7 +391,7 @@ private function backup_standalone_postgresql(string $database): void
|
|||
{
|
||||
try {
|
||||
$commands[] = 'mkdir -p '.$this->backup_dir;
|
||||
$backupCommand = "docker exec";
|
||||
$backupCommand = 'docker exec';
|
||||
if ($this->postgres_password) {
|
||||
$backupCommand .= " -e PGPASSWORD=$this->postgres_password";
|
||||
}
|
||||
|
|
@ -468,7 +468,7 @@ private function remove_old_backups(): void
|
|||
if ($this->backup->number_of_backups_locally === 0) {
|
||||
$deletable = $this->backup->executions()->where('status', 'success');
|
||||
} else {
|
||||
$deletable = $this->backup->executions()->where('status', 'success')->orderByDesc('created_at')->skip($this->backup->number_of_backups_locally - 1);
|
||||
$deletable = $this->backup->executions()->where('status', 'success')->skip($this->backup->number_of_backups_locally - 1);
|
||||
}
|
||||
foreach ($deletable->get() as $execution) {
|
||||
delete_backup_locally($execution->filename, $this->server);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public function download_file($exeuctionId)
|
|||
public function refreshBackupExecutions(): void
|
||||
{
|
||||
if ($this->backup) {
|
||||
$this->executions = $this->backup->executions()->get()->sortBy('created_at');
|
||||
$this->executions = $this->backup->executions()->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue