feat(backup): implement custom database type selection and enhance scheduled backups management
This commit is contained in:
@@ -19,6 +19,8 @@ class ScheduledBackups extends Component
|
||||
|
||||
public $s3s;
|
||||
|
||||
public string $custom_type = 'mysql';
|
||||
|
||||
protected $listeners = ['refreshScheduledBackups'];
|
||||
|
||||
protected $queryString = ['selectedBackupId'];
|
||||
@@ -49,6 +51,14 @@ class ScheduledBackups extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function setCustomType()
|
||||
{
|
||||
$this->database->custom_type = $this->custom_type;
|
||||
$this->database->save();
|
||||
$this->dispatch('success', 'Database type set.');
|
||||
$this->refreshScheduledBackups();
|
||||
}
|
||||
|
||||
public function delete($scheduled_backup_id): void
|
||||
{
|
||||
$this->database->scheduledBackups->find($scheduled_backup_id)->delete();
|
||||
@@ -62,5 +72,6 @@ class ScheduledBackups extends Component
|
||||
if ($id) {
|
||||
$this->setSelectedBackup($id);
|
||||
}
|
||||
$this->dispatch('refreshScheduledBackups');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ class Database extends Component
|
||||
'is_log_drain_enabled' => $serviceDatabase->is_log_drain_enabled,
|
||||
'image' => $serviceDatabase->image,
|
||||
'service_id' => $service->id,
|
||||
'is_migrated' => true,
|
||||
]);
|
||||
$serviceDatabase->delete();
|
||||
DB::commit();
|
||||
|
||||
@@ -24,7 +24,7 @@ class Index extends Component
|
||||
|
||||
public $s3s;
|
||||
|
||||
protected $listeners = ['generateDockerCompose'];
|
||||
protected $listeners = ['generateDockerCompose', 'refreshScheduledBackups' => '$refresh'];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
|
||||
@@ -88,6 +88,7 @@ class ServiceApplicationView extends Component
|
||||
'is_log_drain_enabled' => $serviceApplication->is_log_drain_enabled,
|
||||
'image' => $serviceApplication->image,
|
||||
'service_id' => $service->id,
|
||||
'is_migrated' => true,
|
||||
]);
|
||||
$serviceApplication->delete();
|
||||
DB::commit();
|
||||
|
||||
@@ -16,6 +16,7 @@ class ServiceDatabase extends BaseModel
|
||||
static::deleting(function ($service) {
|
||||
$service->persistentStorages()->delete();
|
||||
$service->fileStorages()->delete();
|
||||
$service->scheduledBackups()->delete();
|
||||
});
|
||||
static::saving(function ($service) {
|
||||
if ($service->isDirty('status')) {
|
||||
@@ -77,6 +78,9 @@ class ServiceDatabase extends BaseModel
|
||||
|
||||
public function databaseType()
|
||||
{
|
||||
if (filled($this->custom_type)) {
|
||||
return 'standalone-'.$this->custom_type;
|
||||
}
|
||||
$image = str($this->image)->before(':');
|
||||
if ($image->contains('supabase/postgres')) {
|
||||
$finalImage = 'supabase/postgres';
|
||||
@@ -141,6 +145,7 @@ class ServiceDatabase extends BaseModel
|
||||
str($this->databaseType())->contains('postgres') ||
|
||||
str($this->databaseType())->contains('postgis') ||
|
||||
str($this->databaseType())->contains('mariadb') ||
|
||||
str($this->databaseType())->contains('mongo');
|
||||
str($this->databaseType())->contains('mongo') ||
|
||||
filled($this->custom_type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user