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