mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 17:12:30 +01:00
Fixes task migration issue, closes #378
This commit is contained in:
parent
f58858206e
commit
b000b4da43
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Pterodactyl\Models\Task;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
@ -17,11 +18,22 @@ class UpgradeTaskSystem extends Migration
|
|||||||
$table->dropForeign(['server']);
|
$table->dropForeign(['server']);
|
||||||
|
|
||||||
$table->renameColumn('server', 'server_id');
|
$table->renameColumn('server', 'server_id');
|
||||||
$table->unsignedInteger('user_id')->after('id');
|
$table->unsignedInteger('user_id')->nullable()->after('id');
|
||||||
|
|
||||||
$table->foreign('server_id')->references('id')->on('servers');
|
$table->foreign('server_id')->references('id')->on('servers');
|
||||||
$table->foreign('user_id')->references('id')->on('users');
|
$table->foreign('user_id')->references('id')->on('users');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DB::transaction(function () {
|
||||||
|
foreach(Task::all() as $task) {
|
||||||
|
$task->user_id = $task->server->owner_id;
|
||||||
|
$task->save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('tasks', function (Blueprint $table) {
|
||||||
|
$table->unsignedInteger('user_id')->nullable(false)->change();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user