clrghouz/database/migrations/2022_10_22_001507_echoarea.php

83 lines
2.1 KiB
PHP
Raw Normal View History

2021-08-11 13:45:30 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Echoarea extends Migration
2021-08-11 13:45:30 +00:00
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('echoareas', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('name');
$table->string('description');
$table->boolean('active');
$table->boolean('public');
$table->string('notes')->nullable();
$table->bigInteger('domain_id');
2021-08-11 13:45:30 +00:00
$table->foreign('domain_id')->references('id')->on('domains');
});
Schema::create('fileareas', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('name');
$table->string('description');
$table->boolean('active');
$table->boolean('public');
$table->string('notes')->nullable();
$table->bigInteger('domain_id');
2021-08-11 13:45:30 +00:00
$table->foreign('domain_id')->references('id')->on('domains');
});
Schema::create('address_echoarea', function (Blueprint $table) {
$table->bigInteger('echoarea_id');
2021-08-11 13:45:30 +00:00
$table->foreign('echoarea_id')->references('id')->on('echoareas');
$table->bigInteger('address_id');
2021-08-11 13:45:30 +00:00
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['echoarea_id','address_id']);
2021-08-11 13:45:30 +00:00
$table->dateTime('subscribed');
});
Schema::create('address_filearea', function (Blueprint $table) {
$table->bigInteger('filearea_id');
2021-08-11 13:45:30 +00:00
$table->foreign('filearea_id')->references('id')->on('fileareas');
$table->bigInteger('address_id');
2021-08-11 13:45:30 +00:00
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['filearea_id','address_id']);
2021-08-11 13:45:30 +00:00
$table->dateTime('subscribed');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('address_echoarea');
2021-08-11 13:45:30 +00:00
Schema::dropIfExists('address_filearea');
Schema::dropIfExists('fileareas');
Schema::dropIfExists('echoareas');
2021-08-11 13:45:30 +00:00
}
}