kick forever
CI/CD / test_and_check_app (push) Successful in 2m19s
CI/CD / Publish immutable image (push) Successful in 1m16s

This commit is contained in:
2026-09-24 14:38:18 +02:00
parent b190ff719e
commit 4dfe79ce5c
22 changed files with 271 additions and 113 deletions
@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$cutoff = now()->subHour();
DB::table('players')
->where(function ($query) use ($cutoff): void {
$query->whereNotNull('inactive_at')
->orWhere('last_seen_at', '<=', $cutoff)
->orWhere(function ($query) use ($cutoff): void {
$query->whereNull('last_seen_at')
->where('created_at', '<=', $cutoff);
});
})
->delete();
Schema::table('players', function (Blueprint $table): void {
$table->dropColumn('inactive_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('players', function (Blueprint $table): void {
$table->timestamp('inactive_at')->nullable()->after('last_seen_at');
});
}
};