50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
|
||
|
class CreateAddresses extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
|
Schema::create('addresses', function (Blueprint $table) {
|
||
|
$table->id();
|
||
|
$table->timestamps();
|
||
|
$table->boolean('active');
|
||
|
|
||
|
$table->integer('zone_id');
|
||
|
$table->foreign('zone_id')->references('id')->on('zones');
|
||
|
|
||
|
$table->integer('region_id')->nullable();
|
||
|
$table->integer('host_id')->nullable();
|
||
|
$table->integer('node_id');
|
||
|
$table->integer('point_id');
|
||
|
$table->integer('status')->nullable(); // @note Used to record Down/Private/Pending, etc
|
||
|
|
||
|
$table->integer('role')->nullable();
|
||
|
|
||
|
$table->integer('system_id');
|
||
|
$table->foreign('system_id')->references('id')->on('systems');
|
||
|
|
||
|
$table->unique(['zone_id','region_id','host_id','node_id']);
|
||
|
$table->unique(['zone_id','host_id','node_id','point_id']);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
|
Schema::dropIfExists('addresses');
|
||
|
}
|
||
|
}
|