cambio a clave primaria compuesta
This commit is contained in:
parent
49c0a29e95
commit
3635e29cf4
|
@ -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');
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue