From 3635e29cf402b6a2dfe53642136d020fc3de6dc5 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:26:47 -0300 Subject: [PATCH] cambio a clave primaria compuesta --- .../2024_03_11_224437_create_productos_pedidos_table.php | 2 +- ...2024_03_12_201211_create_productos_caracteristicas_table.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php b/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php index e61e66b..51f50a9 100644 --- a/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php +++ b/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php @@ -12,11 +12,11 @@ public function up(): void { Schema::create('productos_pedidos', function (Blueprint $table) { - $table->id(); $table->unsignedBigInteger('pedido_id'); $table->unsignedBigInteger('producto_id'); $table->unsignedInteger('ammount'); $table->timestamps(); + $table->primary(['pedido_id','producto_id']); $table->foreign('pedido_id')->references('id')->on('pedidos'); $table->foreign('producto_id')->references('id')->on('productos'); }); diff --git a/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php index 4e6a45e..d07eb3f 100644 --- a/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php +++ b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php @@ -12,10 +12,10 @@ public function up(): void { Schema::create('productos_caracteristicas', function (Blueprint $table) { - $table->id(); $table->unsignedBigInteger('producto_id'); $table->unsignedBigInteger('caracteristica_id'); $table->timestamps(); + $table->primary(['producto_id','caracteristica_id']); $table->foreign('producto_id')->references('id')->on('productos'); $table->foreign('caracteristica_id')->references('id')->on('caracteristicas'); });