37 lines
1.2 KiB
PHP
37 lines
1.2 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->foreignId('console_id')->constrained()->cascadeOnDelete();
|
|
$table->string('title');
|
|
$table->string('slug');
|
|
$table->integer('igdb_id')->nullable();
|
|
$table->integer('tgdb_id')->nullable();
|
|
$table->text('description')->nullable();
|
|
$table->integer('release_year')->nullable();
|
|
$table->string('developer')->nullable();
|
|
$table->string('publisher')->nullable();
|
|
$table->string('genre')->nullable();
|
|
$table->decimal('rating', 3, 1)->nullable();
|
|
$table->string('cover_path')->nullable();
|
|
$table->string('thumbnail_path')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['console_id', 'slug']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('games');
|
|
}
|
|
};
|