<?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('product_module_configs', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('product_id'); $t->string('module_name', 255); $t->string('field_key', 255); $t->text('field_value')->nullable(); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->unique(['product_id', 'module_name', 'field_key'], 'product_module_configs_product_id_module_name_field_key_unique'); $t->index(['product_id', 'module_name'], 'product_module_configs_product_id_module_name_index'); $t->foreign('product_id', 'product_module_configs_product_id_foreign')->references('id')->on('products')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('product_module_configs'); } }; 