<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateNetmailTables extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('kludge_netmail', function (Blueprint $table) { $table->integer('netmail_id'); $table->string('kludge_id')->nullable(); $table->json('value'); $table->index('netmail_id'); $table->foreign('netmail_id')->references('id')->on('netmails'); }); Schema::create('netmail_path', function (Blueprint $table) { $table->integer('netmail_id'); $table->integer('node_id'); $table->integer('sequence'); $table->json('value'); $table->unique(['netmail_id','sequence']); $table->index('netmail_id'); $table->foreign('netmail_id')->references('id')->on('netmails'); $table->index('node_id'); $table->foreign('node_id')->references('id')->on('nodes'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('netmail_path'); Schema::dropIfExists('kludge_netmail'); } }