id(); $table->foreignId('thread_id')->nullable()->constrained('threads')->nullOnDelete(); $table->foreignId('post_id')->nullable()->constrained('posts')->nullOnDelete(); $table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete(); $table->string('disk', 50)->default('local'); $table->string('path'); $table->string('original_name'); $table->string('extension', 30)->nullable(); $table->string('mime_type', 150); $table->unsignedBigInteger('size_bytes'); $table->timestamps(); $table->softDeletes(); $table->index('thread_id', 'idx_attachments_thread_id'); $table->index('post_id', 'idx_attachments_post_id'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('attachments'); } };