2021-06-25 11:31:57 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
2022-10-23 02:46:46 +00:00
|
|
|
class Nodelists extends Migration
|
2021-06-25 11:31:57 +00:00
|
|
|
{
|
2022-10-23 02:46:46 +00:00
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2021-06-25 11:31:57 +00:00
|
|
|
Schema::create('nodelists', function (Blueprint $table) {
|
|
|
|
$table->id();
|
|
|
|
$table->timestamps();
|
|
|
|
$table->date('date');
|
2022-11-19 04:45:59 +00:00
|
|
|
$table->bigInteger('domain_id');
|
2021-06-25 11:31:57 +00:00
|
|
|
$table->foreign('domain_id')->references('id')->on('domains');
|
|
|
|
|
|
|
|
$table->unique(['date','domain_id']);
|
2022-10-23 02:46:46 +00:00
|
|
|
|
|
|
|
$table->softDeletes();
|
2021-06-25 11:31:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Schema::create('address_nodelist', function (Blueprint $table) {
|
|
|
|
$table->integer('role')->nullable();
|
|
|
|
|
2022-11-19 04:45:59 +00:00
|
|
|
$table->bigInteger('address_id');
|
2021-06-25 11:31:57 +00:00
|
|
|
$table->foreign('address_id')->references('id')->on('addresses');
|
2022-11-19 04:45:59 +00:00
|
|
|
$table->bigInteger('nodelist_id');
|
2021-06-25 11:31:57 +00:00
|
|
|
$table->foreign('nodelist_id')->references('id')->on('nodelists');
|
|
|
|
|
|
|
|
$table->unique(['address_id','nodelist_id']);
|
|
|
|
});
|
2022-10-23 02:46:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
2021-06-25 11:31:57 +00:00
|
|
|
Schema::dropIfExists('address_nodelist');
|
|
|
|
Schema::dropIfExists('nodelists');
|
2022-10-23 02:46:46 +00:00
|
|
|
}
|
2021-06-25 11:31:57 +00:00
|
|
|
}
|