增加 外键
This commit is contained in:
parent
c75249cc31
commit
34f1b47ccc
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('hosts', function (Blueprint $table) {
|
||||
$table->foreign('module_id')->references('id')->on('modules')->cascadeOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('hosts', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user