Files
gamelog/database/migrations/2026_05_28_213107_create_games_table.php
T

29 lines
1.3 KiB
PHP

<?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();
$table->string('release_year', 4)->nullable();
$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'); }
};