database backups

This commit is contained in:
Saeed Vaziry
2023-08-25 21:05:18 +02:00
parent f9ac454a7c
commit ea3f011f34
55 changed files with 1111 additions and 172 deletions

View File

@ -2,6 +2,7 @@
namespace App\Models;
use App\Enums\BackupFileStatus;
use App\Jobs\Backup\RestoreDatabase;
use App\Jobs\StorageProvider\DeleteFile;
use Carbon\Carbon;
@ -75,12 +76,12 @@ public function getPathAttribute(): string
public function getStoragePathAttribute(): string
{
return '/'.$this->backup->name.'/'.$this->name.'.zip';
return '/'.$this->backup->database->name.'/'.$this->name.'.zip';
}
public function restore(Database $database): void
{
$this->status = 'restoring';
$this->status = BackupFileStatus::RESTORING;
$this->restored_to = $database->name;
$this->save();
dispatch(new RestoreDatabase($this, $database))->onConnection('ssh');