Nodelist import
This commit is contained in:
33
database/migrations/2019_04_16_105252_create_zt.php
Normal file
33
database/migrations/2019_04_16_105252_create_zt.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateZt extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('zt', function (Blueprint $table) {
|
||||
$table->binary('id',10)->unique();
|
||||
$table->timestamps();
|
||||
$table->text('api');
|
||||
$table->binary('token',24);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('zt');
|
||||
}
|
||||
}
|
41
database/migrations/2019_04_16_105253_create_zones.php
Normal file
41
database/migrations/2019_04_16_105253_create_zones.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateZones extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('zones', function (Blueprint $table) {
|
||||
$table->integer('id')->primary();
|
||||
$table->timestamps();
|
||||
$table->binary('zt_id',10)->nullable();
|
||||
$table->binary('ztnet',6)->nullable();
|
||||
$table->ipAddress('ipv4')->nullable();
|
||||
$table->integer('ipv4_mask')->nullable();
|
||||
$table->ipAddress('ipv6')->nullable();
|
||||
$table->integer('ipv6_mask')->nullable();
|
||||
|
||||
$table->unique('zt_id');
|
||||
$table->foreign('zt_id')->references('id')->on('zt');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('zones');
|
||||
}
|
||||
}
|
57
database/migrations/2019_04_16_105254_create_nodes.php
Normal file
57
database/migrations/2019_04_16_105254_create_nodes.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
34
database/migrations/2019_04_16_105255_create_flags.php
Normal file
34
database/migrations/2019_04_16_105255_create_flags.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFlags extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('flags');
|
||||
Schema::create('flags', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('flag')->unique();
|
||||
$table->string('description');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('flags');
|
||||
}
|
||||
}
|
39
database/migrations/2019_04_16_105256_create_flag_node.php
Normal file
39
database/migrations/2019_04_16_105256_create_flag_node.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFlagNode extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('flag_node');
|
||||
Schema::create('flag_node', function (Blueprint $table) {
|
||||
$table->integer('flag_id');
|
||||
$table->integer('node_id');
|
||||
$table->string('arguments')->nullable();
|
||||
|
||||
$table->index('node_id');
|
||||
$table->index('flag_id');
|
||||
$table->unique(['node_id','flag_id']);
|
||||
$table->foreign('node_id')->references('id')->on('nodes');
|
||||
$table->foreign('flag_id')->references('id')->on('flags');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('flag_node');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user