feat: refactor product detail retrieval to simplify variant handling and enhance response structure

This commit is contained in:
2026-07-01 01:05:21 +00:00
parent 429fa36b05
commit 1aa831f921
5 changed files with 98 additions and 90 deletions

View File

@@ -38,6 +38,10 @@ return new class extends Migration
});
// 4. Point variant values to the product-attribute pivot instead of the base attribute
Schema::table('productos_variantes_values', function (Blueprint $table) {
$table->index('producto_variante_id', 'prod_var_values_variant_id_index');
});
Schema::table('productos_variantes_values', function (Blueprint $table) {
$table->dropForeign('productos_variantes_definiciones_attribute_id_foreign');
$table->dropUnique('prod_var_def_variant_attr_unique');
@@ -85,6 +89,10 @@ return new class extends Migration
$table->unique(['producto_variante_id', 'attribute_id'], 'prod_var_def_variant_attr_unique');
});
Schema::table('productos_variantes_values', function (Blueprint $table) {
$table->dropIndex('prod_var_values_variant_id_index');
});
Schema::dropIfExists('products_attributes');
Schema::rename('productos_variantes_values', 'productos_variantes_definiciones');
Schema::rename('attribute', 'productos_attributes');