mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-06 06:15:51 -05:00
Clear allocation notes on server deletion (#5157)
This commit is contained in:
@@ -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
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user