id(); $table->string('spool_no')->unique(); $table->string('pdf_file')->nullable(); $table->text('description')->nullable(); $table->timestamps(); }); // PDFM Elements Table Schema::create('pdfm_elements', function (Blueprint $table) { $table->id(); $table->string('element_code')->unique(); $table->string('spool_no')->nullable(); $table->string('element_type')->nullable(); $table->text('description')->nullable(); $table->timestamps(); $table->index('spool_no'); }); // PDFM Joints Table Schema::create('pdfm_joints', function (Blueprint $table) { $table->id(); $table->string('joint_no')->unique(); $table->string('spool_no')->nullable(); $table->string('element_from')->nullable(); $table->string('element_to')->nullable(); $table->string('joint_type')->nullable(); $table->text('description')->nullable(); $table->timestamps(); $table->index('spool_no'); }); // PDFM Welders Table Schema::create('pdfm_welders', function (Blueprint $table) { $table->id(); $table->string('welder_name'); $table->string('welder_code')->unique(); $table->string('qualification')->nullable(); $table->date('qualification_date')->nullable(); $table->date('expiry_date')->nullable(); $table->text('notes')->nullable(); $table->timestamps(); }); // PDFM Welder Assignments Table (many-to-many relationship) Schema::create('pdfm_welder_assignments', function (Blueprint $table) { $table->id(); $table->string('joint_no'); $table->unsignedBigInteger('welder_id'); $table->date('assignment_date')->nullable(); $table->timestamps(); $table->foreign('welder_id')->references('id')->on('pdfm_welders')->onDelete('cascade'); $table->index('joint_no'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('pdfm_welder_assignments'); Schema::dropIfExists('pdfm_welders'); Schema::dropIfExists('pdfm_joints'); Schema::dropIfExists('pdfm_elements'); Schema::dropIfExists('pdfm_spools'); } }