clrghouz/database/migrations/2019_04_26_113128_create_netmail_tables.php

51 lines
1.1 KiB
PHP
Raw Normal View History

2019-05-06 12:29:29 +00:00
<?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');
2019-05-06 12:29:29 +00:00
$table->index('netmail_id');
$table->foreign('netmail_id')->references('id')->on('netmails');
});
2019-05-06 12:29:29 +00:00
Schema::create('netmail_path', function (Blueprint $table) {
$table->integer('netmail_id');
$table->integer('node_id');
$table->integer('sequence');
$table->json('value');
2019-05-06 12:29:29 +00:00
$table->unique(['netmail_id','sequence']);
2019-05-06 12:29:29 +00:00
$table->index('netmail_id');
$table->foreign('netmail_id')->references('id')->on('netmails');
$table->index('node_id');
$table->foreign('node_id')->references('id')->on('nodes');
});
}
2019-05-06 12:29:29 +00:00
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('netmail_path');
Schema::dropIfExists('kludge_netmail');
}
2019-05-06 12:29:29 +00:00
}