Files
SkinbaseNova/database/migrations/2026_03_18_120000_create_leaderboards_table.php
2026-03-20 21:17:26 +01:00

31 lines
793 B
PHP

<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('leaderboards', function (Blueprint $table): void {
$table->id();
$table->string('type', 20);
$table->unsignedBigInteger('entity_id');
$table->decimal('score', 14, 2)->default(0);
$table->string('period', 20);
$table->timestamps();
$table->unique(['type', 'period', 'entity_id']);
$table->index(['type', 'period', 'score']);
});
}
public function down(): void
{
Schema::dropIfExists('leaderboards');
}
};