Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AgregarIdClienteVentas extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ventas', function (Blueprint $table) {
$table->unsignedBigInteger('id_cliente');
$table->foreign("id_cliente")
->references("id")
->on("clientes")
->onDelete("cascade")
->onUpdate("cascade");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ventas', function (Blueprint $table) {
//
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment