Expand IGDB data: collections, game modes, themes, perspectives, videos, websites, age ratings, similar games; add backfill command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mark
2026-06-01 00:24:05 +03:00
co-authored by Claude Sonnet 4.6
parent 0eab3e8dbf
commit 2a724c0ae2
21 changed files with 768 additions and 57 deletions
@@ -0,0 +1,16 @@
<?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('collections', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('igdb_id')->unique();
$table->string('name');
$table->string('slug')->nullable();
$table->timestamps();
});
}
public function down(): void { Schema::dropIfExists('collections'); }
};
@@ -0,0 +1,16 @@
<?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('game_modes', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('igdb_id')->unique();
$table->string('name');
$table->string('slug')->nullable();
$table->timestamps();
});
}
public function down(): void { Schema::dropIfExists('game_modes'); }
};
@@ -0,0 +1,16 @@
<?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('themes', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('igdb_id')->unique();
$table->string('name');
$table->string('slug')->nullable();
$table->timestamps();
});
}
public function down(): void { Schema::dropIfExists('themes'); }
};
@@ -0,0 +1,16 @@
<?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('player_perspectives', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('igdb_id')->unique();
$table->string('name');
$table->string('slug')->nullable();
$table->timestamps();
});
}
public function down(): void { Schema::dropIfExists('player_perspectives'); }
};
@@ -0,0 +1,25 @@
<?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::table('games', function (Blueprint $table) {
$table->unsignedBigInteger('collection_id')->nullable()->after('igdb_id');
$table->string('age_rating_pegi', 10)->nullable()->after('summary');
$table->string('age_rating_esrb', 10)->nullable()->after('age_rating_pegi');
$table->decimal('aggregated_rating', 5, 2)->nullable()->after('age_rating_esrb');
$table->unsignedInteger('aggregated_rating_count')->nullable()->after('aggregated_rating');
$table->text('storyline')->nullable()->after('summary');
$table->json('similar_game_igdb_ids')->nullable()->after('storyline');
$table->foreign('collection_id')->references('id')->on('collections')->nullOnDelete();
});
}
public function down(): void {
Schema::table('games', function (Blueprint $table) {
$table->dropForeign(['collection_id']);
$table->dropColumn(['collection_id', 'age_rating_pegi', 'age_rating_esrb', 'aggregated_rating', 'aggregated_rating_count', 'storyline', 'similar_game_igdb_ids']);
});
}
};
@@ -0,0 +1,17 @@
<?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('game_videos', function (Blueprint $table) {
$table->id();
$table->foreignId('game_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('igdb_id')->nullable();
$table->string('name')->nullable();
$table->string('video_id');
$table->timestamps();
});
}
public function down(): void { Schema::dropIfExists('game_videos'); }
};
@@ -0,0 +1,16 @@
<?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('game_websites', function (Blueprint $table) {
$table->id();
$table->foreignId('game_id')->constrained()->cascadeOnDelete();
$table->unsignedTinyInteger('category');
$table->string('url');
$table->timestamps();
});
}
public function down(): void { Schema::dropIfExists('game_websites'); }
};
@@ -0,0 +1,16 @@
<?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('similar_games', function (Blueprint $table) {
$table->unsignedBigInteger('game_id');
$table->unsignedBigInteger('similar_game_id');
$table->primary(['game_id', 'similar_game_id']);
$table->foreign('game_id')->references('id')->on('games')->cascadeOnDelete();
$table->foreign('similar_game_id')->references('id')->on('games')->cascadeOnDelete();
});
}
public function down(): void { Schema::dropIfExists('similar_games'); }
};
@@ -0,0 +1,30 @@
<?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('game_game_mode', function (Blueprint $table) {
$table->foreignId('game_id')->constrained()->cascadeOnDelete();
$table->foreignId('game_mode_id')->constrained('game_modes')->cascadeOnDelete();
$table->primary(['game_id', 'game_mode_id']);
});
Schema::create('game_theme', function (Blueprint $table) {
$table->foreignId('game_id')->constrained()->cascadeOnDelete();
$table->foreignId('theme_id')->constrained('themes')->cascadeOnDelete();
$table->primary(['game_id', 'theme_id']);
});
Schema::create('game_player_perspective', function (Blueprint $table) {
$table->foreignId('game_id')->constrained()->cascadeOnDelete();
$table->foreignId('player_perspective_id')->constrained('player_perspectives')->cascadeOnDelete();
$table->primary(['game_id', 'player_perspective_id']);
});
}
public function down(): void {
Schema::dropIfExists('game_player_perspective');
Schema::dropIfExists('game_theme');
Schema::dropIfExists('game_game_mode');
}
};