clrghouz/database/migrations/2019_04_16_105254_create_nodes.php
2019-04-26 14:30:00 +10:00

58 lines
1.3 KiB
PHP

<?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();
$table->integer('region_id');
$table->integer('host_id')->index();
$table->integer('hub_id')->nullable()->index();
$table->integer('node_id')->index();
$table->binary('active');
$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();
$table->unique(['zone_id','region_id','id']);
$table->unique(['zone_id','zt']);
// $table->index('zone_id');
$table->foreign('zone_id')->references('id')->on('zones');
$table->unique(['zone_id','host_id','id']);
// $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');
}
}