create('attachments', function (Blueprint $table): void { $table->id(); // К чему приложено: раздел и запись $table->string('entity', 64); $table->string('entity_id', 64); $table->string('path', 255); $table->string('name', 191); $table->string('mime', 128)->default(''); $table->integer('size')->default(0); $table->foreignId('user_id')->nullable(); $table->dateTime('created_at')->nullable(); $table->dateTime('updated_at')->nullable(); $table->index('idx_attachments_owner', ['entity', 'entity_id']); $table->unique('idx_attachments_path', 'path'); }); } public function down(): void { $this->drop('attachments'); } }