diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index a83c8feb6a..57cce873b4 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -35,7 +35,7 @@ public function withForce(bool $bool = true): self } /** - * Delete a server from the panel and remove any associated databases from hosts. + * Delete a server from the panel, clear any allocation notes, and remove any associated databases from hosts. * * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException @@ -77,7 +77,12 @@ public function handle(Server $server): void } } + // clear any allocation notes for the server + $server->allocations->each(function ($allocation) { + $allocation->update(['notes' => null]); + }); + $server->delete(); }); } -} +} \ No newline at end of file diff --git a/database/migrations/2024_07_13_091852_clear_unused_allocation_notes.php b/database/migrations/2024_07_13_091852_clear_unused_allocation_notes.php new file mode 100644 index 0000000000..9e2b36c8b1 --- /dev/null +++ b/database/migrations/2024_07_13_091852_clear_unused_allocation_notes.php @@ -0,0 +1,26 @@ +where('server_id', null) + ->whereNot('notes', null) + ->update(['notes' => null]); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // Reverse not needed + } +}; \ No newline at end of file