<?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::create('netmail_path', function (Blueprint $table) { $table->id(); $table->bigInteger('address_id'); $table->foreign('address_id')->references('id')->on('addresses'); $table->unique(['id','netmail_id']); $table->unique(['netmail_id','address_id','parent_id']); $table->bigInteger('parent_id')->nullable(); $table->foreign(['parent_id','netmail_id'])->references(['id','netmail_id'])->on('netmail_path'); $table->bigInteger('netmail_id'); $table->foreign('netmail_id')->references('id')->on('netmails'); $table->dateTime('datetime'); $table->string('program'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('netmail_path'); } };