Created
March 11, 2020 03:56
-
-
Save parzibyte/8154cbaa4d9dd5d63ece12fae112ecfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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