mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
pgBackRest Further code quality changes Clean up code Small fix Hopefully the last bit of cleanup? Remove old comment! A couple more improvements Squash migrations
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ScheduledDatabaseBackupExecution extends BaseModel
|
|
{
|
|
protected $guarded = [];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
's3_uploaded' => 'boolean',
|
|
'local_storage_deleted' => 'boolean',
|
|
's3_storage_deleted' => 'boolean',
|
|
'pgbackrest_repo_size' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function scheduledDatabaseBackup(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ScheduledDatabaseBackup::class);
|
|
}
|
|
|
|
public function restores(): HasMany
|
|
{
|
|
return $this->hasMany(DatabaseRestore::class, 'scheduled_database_backup_execution_id');
|
|
}
|
|
|
|
public function isPgBackrest(): bool
|
|
{
|
|
return $this->engine === 'pgbackrest';
|
|
}
|
|
|
|
public function isNative(): bool
|
|
{
|
|
return $this->engine === 'native' || $this->engine === null;
|
|
}
|
|
|
|
public function canRestore(): bool
|
|
{
|
|
return $this->isPgBackrest()
|
|
&& $this->status === 'success'
|
|
&& ! empty($this->pgbackrest_label);
|
|
}
|
|
}
|