Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/Services/Servers/ServerDeletionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::table('allocations')
->where('server_id', null)
->whereNot('notes', null)
->update(['notes' => null]);
}

/**
* Reverse the migrations.
*/
public function down(): void
{
// Reverse not needed
}
};