Files
pterodactyl-panel/database/migrations/old/2017_03_10_173607_MigrateToNewServiceSystem.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

43 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
class MigrateToNewServiceSystem extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::transaction(function (): void {
$service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
if (! $service) {
return;
}
$options = DB::table('service_options')->where('service_id', $service->id)->get();
$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';
}
$item->save();
});
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Not doing reversals right now...
}
}