clrghouz/database/migrations/2019_04_16_105254_create_nodes.php

58 lines
1.4 KiB
PHP
Raw Normal View History

2019-04-26 04:30:00 +00:00
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNodes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('nodes', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('zone_id')->index();
2019-04-27 13:57:39 +00:00
$table->integer('region_id')->nullable();
2019-04-26 04:30:00 +00:00
$table->integer('host_id')->index();
$table->integer('hub_id')->nullable()->index();
$table->integer('node_id')->index();
2019-04-27 13:57:39 +00:00
$table->integer('point_id')->default(0);
2019-04-26 04:30:00 +00:00
2019-04-27 13:57:39 +00:00
$table->boolean('active');
2019-04-26 04:30:00 +00:00
$table->string('status')->nullable();
$table->string('system');
$table->string('sysop');
$table->string('location');
$table->integer('baud');
$table->string('phone')->nullable();
$table->binary('zt',10)->nullable();
2019-04-27 13:57:39 +00:00
$table->unique(['zone_id','host_id','node_id','point_id']);
2019-04-26 04:30:00 +00:00
$table->unique(['zone_id','zt']);
$table->foreign('zone_id')->references('id')->on('zones');
2019-04-27 13:57:39 +00:00
// $table->unique(['zone_id','host_id','id']);
2019-04-26 04:30:00 +00:00
// $table->index(['zone_id','host_id']);
// $table->index(['zone_id','id']);
// $table->foreign(['zone_id','host_id'])->references(['zone_id','id'])->on('nodes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('nodes');
}
}