clrghouz/database/migrations/2019_04_26_112228_create_echomail_tables.php

63 lines
1.5 KiB
PHP

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