Merge pull request #4287 from peaklabs-dev/fix-backups

Fix: Backups
This commit is contained in:
Andras Bacsai 2024-11-15 10:49:48 +01:00 committed by GitHub
commit 469e009600
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,8 +21,8 @@ class CreateScheduledBackup extends Component
public bool $enabled = true;
#[Validate(['required', 'integer'])]
public int $s3StorageId;
#[Validate(['nullable', 'integer'])]
public ?int $s3StorageId = null;
public Collection $definedS3s;
@ -49,6 +49,7 @@ public function submit()
return;
}
$payload = [
'enabled' => true,
'frequency' => $this->frequency,
@ -58,6 +59,7 @@ public function submit()
'database_type' => $this->database->getMorphClass(),
'team_id' => currentTeam()->id,
];
if ($this->database->type() === 'standalone-postgresql') {
$payload['databases_to_backup'] = $this->database->postgres_db;
} elseif ($this->database->type() === 'standalone-mysql') {
@ -72,11 +74,11 @@ public function submit()
} else {
$this->dispatch('refreshScheduledBackups');
}
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->frequency = '';
$this->saveToS3 = true;
}
}
}