Files
gamelog/database/migrations/2026_05_28_213108_create_reviews_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

22 lines
911 B
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('reviews', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('game_id')->constrained()->cascadeOnDelete();
$table->unsignedTinyInteger('rating')->nullable(); // 1-10
$table->text('body');
$table->boolean('has_spoilers')->default(false);
$table->unsignedInteger('helpful_count')->default(0);
$table->timestamps();
$table->unique(['user_id', 'game_id']);
$table->index(['game_id', 'helpful_count']);
});
}
public function down(): void { Schema::dropIfExists('reviews'); }
};