Files

40 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
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
{
DB::transaction(function () {
2017-10-06 23:57:53 -05:00
$service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
2021-01-23 12:33:34 -08: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();
2021-01-23 12:09:16 -08:00
$options->each(function ($item) {
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();
});
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...
}
}