2021_06_20_080846_create_folders_table.php
1 <?php 2 3 use App\Models\Dossier; 4 use Illuminate\Database\Migrations\Migration; 5 use Illuminate\Database\Schema\Blueprint; 6 use Illuminate\Support\Facades\Schema; 7 8 return new class extends Migration 9 { 10 /** 11 * Run the migrations. 12 * 13 * @return void 14 */ 15 public function up() 16 { 17 Schema::create('folders', function (Blueprint $table) { 18 $table->id(); 19 $table->foreignIdFor(Dossier::class)->nullable()->index(); 20 $table->string('name'); 21 $table->foreignId('created_by')->nullable()->constrained('users'); 22 $table->integer('number_files')->default(0); 23 $table->bigInteger('size')->default(0); 24 $table->nestedSet(); 25 $table->timestamps(); 26 }); 27 } 28 29 /** 30 * Reverse the migrations. 31 * 32 * @return void 33 */ 34 public function down() 35 { 36 Schema::dropIfExists('folders'); 37 } 38 };