Skip to content

Commit 3f6d782

Browse files
committed
Fix forgotten migration that caused node deletions to not be cascaded to all allocations.
closes pterodactyl#795
1 parent df7a857 commit 3f6d782

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
1111
* `[beta.2]` — Someone found a `@todo` that I never `@todid` and thus database hosts could not be created without being linked to a node. This is fixed...
1212
* `[beta.2]` — Fixes bug that caused incorrect rendering of CPU usage on server graphs due to missing variable.
1313
* `[beta.2]` — Fixes bug causing schedules to be un-deletable.
14+
* `[beta.2]` — Fixes bug that prevented the deletion of nodes due to an allocation deletion cascade issue with the SQL schema.
1415

1516
### Changed
1617
* Revoking the administrative status for an admin will revoke all authentication tokens currently assigned to their account.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class DropAllocationsWhenNodeIsDeleted extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up()
13+
{
14+
Schema::table('allocations', function (Blueprint $table) {
15+
$table->dropForeign(['node_id']);
16+
17+
$table->foreign('node_id')->references('id')->on('nodes')->onDelete('cascade');
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*/
24+
public function down()
25+
{
26+
Schema::table('allocations', function (Blueprint $table) {
27+
$table->dropForeign(['node_id']);
28+
29+
$table->foreign('node_id')->references('id')->on('nodes');
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)