Import nodelists
This commit is contained in:
48
database/migrations/2021_06_25_040417_create_nodelist.php
Normal file
48
database/migrations/2021_06_25_040417_create_nodelist.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNodelist extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nodelists', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->date('date');
|
||||
$table->integer('domain_id');
|
||||
$table->foreign('domain_id')->references('id')->on('domains');
|
||||
|
||||
$table->unique(['date','domain_id']);
|
||||
});
|
||||
|
||||
Schema::create('address_nodelist', function (Blueprint $table) {
|
||||
$table->integer('role')->nullable();
|
||||
|
||||
$table->integer('address_id');
|
||||
$table->foreign('address_id')->references('id')->on('addresses');
|
||||
$table->integer('nodelist_id');
|
||||
$table->foreign('nodelist_id')->references('id')->on('nodelists');
|
||||
|
||||
$table->unique(['address_id','nodelist_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('address_nodelist');
|
||||
Schema::dropIfExists('nodelists');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user