Files

43 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2017-03-10 18:25:12 -05:00
<?php
2022-10-14 10:59:20 -06:00
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
2017-03-10 18:25:12 -05:00
use Illuminate\Database\Migrations\Migration;
class MigrateToNewServiceSystem extends Migration
{
/**
* Run the migrations.
*/
2024-10-21 19:18:20 -06:00
public function up(): void
2017-03-10 18:25:12 -05:00
{
2026-10-05 18:10:18 -04:00
DB::transaction(function (): void {
2017-10-06 23:57:53 -05:00
$service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
2026-10-05 18:10:18 -04:00
if (! $service) {
return;
2017-03-12 18:05:30 -04:00
}
2017-10-06 23:57:53 -05:00
$options = DB::table('service_options')->where('service_id', $service->id)->get();
2026-10-05 18:10:18 -04:00
$options->each(function ($item): void {
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
$item->tag = 'insurgency';
} elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') {
$item->tag = 'tf2';
} elseif ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') {
$item->tag = 'source';
}
2026-10-05 18:10:18 -04:00
$item->save();
});
2017-03-12 18:05:30 -04:00
});
2017-03-10 18:25:12 -05:00
}
/**
* Reverse the migrations.
*/
2024-10-21 19:18:20 -06:00
public function down(): void
2017-03-10 18:25:12 -05:00
{
// Not doing reversals right now...
}
}