clrghouz/database/migrations/2022_10_22_004225_nodelists.php

51 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2021-06-25 11:31:57 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Nodelists extends Migration
2021-06-25 11:31:57 +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');
$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']);
$table->softDeletes();
2021-06-25 11:31:57 +00:00
});
Schema::create('address_nodelist', function (Blueprint $table) {
$table->integer('role')->nullable();
$table->bigInteger('address_id');
2021-06-25 11:31:57 +00:00
$table->foreign('address_id')->references('id')->on('addresses');
$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']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
2021-06-25 11:31:57 +00:00
Schema::dropIfExists('address_nodelist');
Schema::dropIfExists('nodelists');
}
2021-06-25 11:31:57 +00:00
}