<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class Nodelists extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('nodelists', function (Blueprint $table) { $table->id(); $table->timestamps(); $table->date('date'); $table->bigInteger('domain_id'); $table->foreign('domain_id')->references('id')->on('domains'); $table->unique(['date','domain_id']); $table->softDeletes(); }); Schema::create('address_nodelist', function (Blueprint $table) { $table->integer('role')->nullable(); $table->bigInteger('address_id'); $table->foreign('address_id')->references('id')->on('addresses'); $table->bigInteger('nodelist_id'); $table->foreign('nodelist_id')->references('id')->on('nodelists'); $table->unique(['address_id','nodelist_id']); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('address_nodelist'); Schema::dropIfExists('nodelists'); } }