From f9a5b5bca750203355effec9dea8bf8b7750e260 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 9 Jul 2024 20:09:29 -0300 Subject: [PATCH] tabla faltante --- .../migrations/2024_07_03_225341_tabla_pedidos.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/database/migrations/2024_07_03_225341_tabla_pedidos.php b/database/migrations/2024_07_03_225341_tabla_pedidos.php index cfcdf95..fbf9a8e 100644 --- a/database/migrations/2024_07_03_225341_tabla_pedidos.php +++ b/database/migrations/2024_07_03_225341_tabla_pedidos.php @@ -21,6 +21,16 @@ public function up(): void $table->foreign('barrio_id')->references('id')->on('barrios'); $table->unique(['barrio_id','nombre']); }); + + Schema::create('pedido_producto', function (Blueprint $table) { + $table->unsignedBigInteger('pedido_id'); + $table->unsignedBigInteger('producto_id'); + $table->unsignedInteger('cantidad'); + $table->timestamps(); + $table->primary(['pedido_id','producto_id']); + $table->foreign('pedido_id')->references('id')->on('pedidos'); + $table->foreign('producto_id')->references('id')->on('productos'); + }); } /** @@ -29,5 +39,6 @@ public function up(): void public function down(): void { Schema::dropIfExists('pedidos'); + Schema::dropIfExists('pedido_producto'); } };