<?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('client_downloads', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('client_id'); $t->unsignedBigInteger('download_id'); $t->string('ip_address', 255)->nullable(); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->index(['client_id', 'download_id'], 'client_downloads_client_id_download_id_index'); $t->index('download_id', 'client_downloads_download_id_foreign'); $t->foreign('client_id', 'client_downloads_client_id_foreign')->references('id')->on('clients')->onDelete('cascade'); $t->foreign('download_id', 'client_downloads_download_id_foreign')->references('id')->on('downloads')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('client_downloads'); } }; 