Clear allocation notes on server deletion (#5157)

This commit is contained in:
Gio
2026-01-04 16:44:46 -08:00
committed by GitHub
parent 5e2e827d48
commit 3dd206ccf7
3 changed files with 32 additions and 1 deletions
+1
View File
@@ -17,6 +17,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
* Fixes node description not being settable via the API.
* Fixes 0-bytes files returning an error when attempting to upload.
* Fixes nodes displaying the first available location even when that field was not edited and the node has a different value set.
* Fixes allocation notes not being reset when a server is deleted. ([#5157](https://github.com/pterodactyl/panel/pull/5157))
### Changed
* Minimum NodeJS version updated to 22 for building.
@@ -35,7 +35,7 @@ class ServerDeletionService
}
/**
* 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,6 +77,10 @@ class ServerDeletionService
}
}
// clear any allocation notes for the server
$server->allocations()->update(['notes' => null]);
$server->delete();
});
}
@@ -0,0 +1,26 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
DB::table('allocations')
->whereNull('server_id')
->update(['notes' => null]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Reverse not needed
}
};