diff --git a/app/Livewire/Project/Database/ScheduledBackups.php b/app/Livewire/Project/Database/ScheduledBackups.php index 412240bd4..51d8cb33e 100644 --- a/app/Livewire/Project/Database/ScheduledBackups.php +++ b/app/Livewire/Project/Database/ScheduledBackups.php @@ -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'); } } diff --git a/app/Livewire/Project/Service/Database.php b/app/Livewire/Project/Service/Database.php index 28e3d3a26..ed4bfe7e9 100644 --- a/app/Livewire/Project/Service/Database.php +++ b/app/Livewire/Project/Service/Database.php @@ -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(); diff --git a/app/Livewire/Project/Service/Index.php b/app/Livewire/Project/Service/Index.php index ba4ebe2fc..39f4e106d 100644 --- a/app/Livewire/Project/Service/Index.php +++ b/app/Livewire/Project/Service/Index.php @@ -24,7 +24,7 @@ class Index extends Component public $s3s; - protected $listeners = ['generateDockerCompose']; + protected $listeners = ['generateDockerCompose', 'refreshScheduledBackups' => '$refresh']; public function mount() { diff --git a/app/Livewire/Project/Service/ServiceApplicationView.php b/app/Livewire/Project/Service/ServiceApplicationView.php index 24f218057..93511636d 100644 --- a/app/Livewire/Project/Service/ServiceApplicationView.php +++ b/app/Livewire/Project/Service/ServiceApplicationView.php @@ -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(); diff --git a/app/Models/ServiceDatabase.php b/app/Models/ServiceDatabase.php index 40d183033..d595721d8 100644 --- a/app/Models/ServiceDatabase.php +++ b/app/Models/ServiceDatabase.php @@ -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); } } diff --git a/resources/views/livewire/project/database/scheduled-backups.blade.php b/resources/views/livewire/project/database/scheduled-backups.blade.php index e8d66d9ee..123ff6fff 100644 --- a/resources/views/livewire/project/database/scheduled-backups.blade.php +++ b/resources/views/livewire/project/database/scheduled-backups.blade.php @@ -1,33 +1,52 @@
- @forelse($database->scheduledBackups as $backup) - @if ($type == 'database') - -
-
Frequency: {{ $backup->frequency }} - ({{ data_get($backup->server(), 'settings.server_timezone', 'Instance timezone') }}) -
-
Last backup: {{ data_get($backup->latest_log, 'status', 'No backup yet') }}
+ @if ($database->is_migrated && blank($database->custom_type)) +
+
Select the type of + database to enable automated backups.
+
If your database is not listed, automated backups are not supported.
+
+
+ + + + + +
-
- @else -
-
- data_get($backup, 'id') === data_get($selectedBackup, 'id'), - 'flex flex-col border-l-2 border-transparent', - ])> -
Frequency: {{ $backup->frequency }} - ({{ data_get($backup->server(), 'settings.server_timezone', 'Instance timezone') }}) + Set + +
+ @else + @forelse($database->scheduledBackups as $backup) + @if ($type == 'database') + +
+
Frequency: {{ $backup->frequency }} + ({{ data_get($backup->server(), 'settings.server_timezone', 'Instance timezone') }}) +
+
Last backup: {{ data_get($backup->latest_log, 'status', 'No backup yet') }}
+
+
+ @else +
+
+ data_get($backup, 'id') === data_get($selectedBackup, 'id'), + 'flex flex-col border-l-2 border-transparent', + ])> +
Frequency: {{ $backup->frequency }} + ({{ data_get($backup->server(), 'settings.server_timezone', 'Instance timezone') }}) +
+
Last backup: {{ data_get($backup->latest_log, 'status', 'No backup yet') }}
-
Last backup: {{ data_get($backup->latest_log, 'status', 'No backup yet') }}
-
- @endif - @empty -
No scheduled backups configured.
- @endforelse + @endif + @empty +
No scheduled backups configured.
+ @endforelse + @endif
@if ($type === 'service-database' && $selectedBackup)
diff --git a/resources/views/livewire/project/service/configuration.blade.php b/resources/views/livewire/project/service/configuration.blade.php index 15ab6fbde..a849dd1d7 100644 --- a/resources/views/livewire/project/service/configuration.blade.php +++ b/resources/views/livewire/project/service/configuration.blade.php @@ -138,7 +138,7 @@
{{ $database->status }}
- @if ($database->isBackupSolutionAvailable()) + @if ($database->isBackupSolutionAvailable() || $database->is_migrated) Backups diff --git a/resources/views/livewire/project/service/index.blade.php b/resources/views/livewire/project/service/index.blade.php index a14ab1bba..fd6ec52f0 100644 --- a/resources/views/livewire/project/service/index.blade.php +++ b/resources/views/livewire/project/service/index.blade.php @@ -10,7 +10,7 @@ General - @if ($serviceDatabase?->isBackupSolutionAvailable()) + @if ($serviceDatabase?->isBackupSolutionAvailable() || $serviceDatabase?->is_migrated) Backups @endif @@ -33,18 +33,20 @@
- @if ($serviceDatabase->isBackupSolutionAvailable()) + @if ($serviceDatabase?->isBackupSolutionAvailable() || $serviceDatabase?->is_migrated)

Scheduled Backups

- - - + @if (filled($serviceDatabase->custom_type)) + + + + @endif
+
@endif
@endisset
-
diff --git a/resources/views/livewire/project/service/service-application-view.blade.php b/resources/views/livewire/project/service/service-application-view.blade.php index 1c0a6d478..87f31ed1f 100644 --- a/resources/views/livewire/project/service/service-application-view.blade.php +++ b/resources/views/livewire/project/service/service-application-view.blade.php @@ -13,8 +13,7 @@ confirmationLabel="Please confirm the execution of the actions by entering the Service Application Name below" shortConfirmationLabel="Service Application Name" step3ButtonText="Permanently Delete" />