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'); } };