From 0432c9bef3cd11118886f08d36053a33964a8855 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 17 Aug 2023 15:30:15 +0200 Subject: [PATCH] separate backups by team as well --- app/Http/Livewire/Project/Database/BackupExecution.php | 2 +- app/Jobs/DatabaseBackupJob.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/Database/BackupExecution.php b/app/Http/Livewire/Project/Database/BackupExecution.php index f963fa1d6..2f9d7dcb5 100644 --- a/app/Http/Livewire/Project/Database/BackupExecution.php +++ b/app/Http/Livewire/Project/Database/BackupExecution.php @@ -17,7 +17,7 @@ public function delete(): void { delete_backup_locally($this->execution->filename, $this->execution->scheduledDatabaseBackup->database->destination->server); $this->execution->delete(); - $this->emit('success', 'Backup execution deleted successfully.'); + $this->emit('success', 'Backup deleted successfully.'); $this->emit('refreshBackupExecutions'); } } diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php index a859b3510..8694eff0d 100644 --- a/app/Jobs/DatabaseBackupJob.php +++ b/app/Jobs/DatabaseBackupJob.php @@ -69,12 +69,12 @@ public function handle(): void return; } $this->container_name = $this->database->uuid; - $this->backup_dir = backup_dir() . "/" . $this->container_name; + $this->backup_dir = backup_dir() . "/" . Str::of($this->team->name)->slug() . '-' .$this->team->id . '/' . $this->container_name; if ($this->database->name === 'coolify-db') { $this->container_name = "coolify-db"; $ip = Str::slug($this->server->ip); - $this->backup_dir = backup_dir() . "/coolify-db-$ip"; + $this->backup_dir = backup_dir() . "/" . Str::of($this->team->name)->slug() . '-' .$this->team->id . "/coolify-db-$ip"; } $this->backup_file = "/dumpall-" . Carbon::now()->timestamp . ".sql"; $this->backup_location = $this->backup_dir . $this->backup_file;