Adds Backup Scheduling MVP (CRUD, dispatcher, run job, retention, audit logs) Run now / Retry persist Filament DB notifications Bulk Run/Retry now create BulkOperationRun so bottom-right progress widget shows them Progress widget includes “recent finished” window + reconciles stale backup bulk runs Adds purge command + migration backup_schedule_runs.user_id + tests updates Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #36
54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class BackupScheduleRun extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const STATUS_RUNNING = 'running';
|
|
|
|
public const STATUS_SUCCESS = 'success';
|
|
|
|
public const STATUS_PARTIAL = 'partial';
|
|
|
|
public const STATUS_FAILED = 'failed';
|
|
|
|
public const STATUS_CANCELED = 'canceled';
|
|
|
|
public const STATUS_SKIPPED = 'skipped';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'scheduled_for' => 'datetime',
|
|
'started_at' => 'datetime',
|
|
'finished_at' => 'datetime',
|
|
'summary' => 'array',
|
|
];
|
|
|
|
public function schedule(): BelongsTo
|
|
{
|
|
return $this->belongsTo(BackupSchedule::class, 'backup_schedule_id');
|
|
}
|
|
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function backupSet(): BelongsTo
|
|
{
|
|
return $this->belongsTo(BackupSet::class);
|
|
}
|
|
}
|