2026-05-29 00:33:00 +03:00
|
|
|
<?php
|
|
|
|
|
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('games', function (Blueprint $table) {
|
|
|
|
|
$table->id();
|
|
|
|
|
$table->unsignedBigInteger('igdb_id')->unique()->nullable();
|
|
|
|
|
$table->string('slug')->unique();
|
|
|
|
|
$table->string('title');
|
|
|
|
|
$table->text('summary')->nullable();
|
|
|
|
|
$table->string('cover_url')->nullable();
|
|
|
|
|
$table->string('cover_thumb_url')->nullable();
|
|
|
|
|
$table->date('release_date')->nullable();
|
2026-05-29 00:37:36 +03:00
|
|
|
$table->string('release_year', 4)->nullable();
|
2026-05-29 00:33:00 +03:00
|
|
|
$table->decimal('rating_avg', 4, 2)->nullable()->default(null);
|
|
|
|
|
$table->unsignedInteger('rating_count')->default(0);
|
|
|
|
|
$table->unsignedInteger('review_count')->default(0);
|
|
|
|
|
$table->unsignedInteger('library_count')->default(0);
|
|
|
|
|
$table->string('status')->default('published'); // published|pending|hidden
|
|
|
|
|
$table->timestamps();
|
|
|
|
|
$table->index(['rating_avg', 'rating_count']);
|
|
|
|
|
$table->index('release_year');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
public function down(): void { Schema::dropIfExists('games'); }
|
|
|
|
|
};
|