Files
gamelog/database/migrations/2026_05_28_213107_create_games_table.php
T
Mark 531e9d445a Initial GameLog setup
- Laravel 11 + Breeze (dark mode) + Tailwind + Alpine.js
- Migrations: games, genres, platforms, companies, pivots,
  user_games, user_lists, reviews, follows, activities
- Models: Game, Genre, Platform, Company, UserGame, UserList,
  Review, ReviewVote, Activity, User (with gamelog fields)
- IgdbService: OAuth2 token management, search, game fetch,
  popular/new releases, genre filter, cover/screenshot URL helpers
- IGDB credentials in config/services.php (from .env)
2026-05-29 00:33:00 +03:00

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()->index();
$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'); }
};