add ability to change servers docker image
This commit is contained in:
parent
7b7bbdf576
commit
812b869be8
5 changed files with 156 additions and 10 deletions
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
|
||||
class AddDockerImageColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->string('image')->after('daemonSecret');
|
||||
});
|
||||
|
||||
// Populate the column
|
||||
$servers = Server::select(
|
||||
'servers.id',
|
||||
'service_options.docker_image as s_optionImage'
|
||||
)->join('service_options', 'service_options.id', '=', 'servers.option')->get();
|
||||
|
||||
foreach ($servers as $server) {
|
||||
$server->image = $server->s_optionImage;
|
||||
$server->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('image');
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue