2017-03-11 00:25:12 +01:00
|
|
|
<?php
|
2022-10-14 18:59:20 +02:00
|
|
|
|
2017-03-11 00:25:12 +01:00
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class MigrateToNewServiceSystem extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
2022-11-25 21:29:04 +01:00
|
|
|
public function up(): void
|
2017-03-11 00:25:12 +01:00
|
|
|
{
|
2017-03-12 23:26:36 +01:00
|
|
|
DB::transaction(function () {
|
2017-10-07 06:57:53 +02:00
|
|
|
$service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
|
2021-01-23 21:33:34 +01:00
|
|
|
if (!$service) {
|
2017-03-12 23:26:36 +01:00
|
|
|
return;
|
2017-03-12 23:05:30 +01:00
|
|
|
}
|
2017-03-12 23:26:36 +01:00
|
|
|
|
2017-10-07 06:57:53 +02:00
|
|
|
$options = DB::table('service_options')->where('service_id', $service->id)->get();
|
2021-01-23 21:09:16 +01:00
|
|
|
$options->each(function ($item) {
|
2017-03-12 23:26:36 +01:00
|
|
|
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';
|
|
|
|
}
|
2017-03-18 18:53:22 +01:00
|
|
|
$item->save();
|
2017-03-12 23:26:36 +01:00
|
|
|
});
|
2017-03-12 23:05:30 +01:00
|
|
|
});
|
2017-03-11 00:25:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
2022-11-25 21:29:04 +01:00
|
|
|
public function down(): void
|
2017-03-11 00:25:12 +01:00
|
|
|
{
|
|
|
|
// Not doing reversals right now...
|
|
|
|
}
|
|
|
|
}
|