feat: service database backups

This commit is contained in:
Andras Bacsai
2023-11-07 12:11:47 +01:00
parent 2976c72e09
commit 516e10ddf2
10 changed files with 173 additions and 41 deletions

View File

@@ -20,6 +20,14 @@ class ServiceDatabase extends BaseModel
{
return 'service';
}
public function databaseType()
{
$image = str($this->image)->before(':');
if ($image->value() === 'postgres') {
$image = 'postgresql';
}
return "standalone-$image";
}
public function service()
{
return $this->belongsTo(Service::class);
@@ -36,4 +44,8 @@ class ServiceDatabase extends BaseModel
{
getFilesystemVolumesFromServer($this, $isInit);
}
public function scheduledBackups()
{
return $this->morphMany(ScheduledDatabaseBackup::class, 'database');
}
}