2021-06-15 12:19:14 +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 Domains extends Migration
|
2021-06-15 12:19:14 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2022-10-23 02:46:46 +00:00
|
|
|
Schema::create('domains', function (Blueprint $table) {
|
|
|
|
$table->id();
|
|
|
|
$table->timestamps();
|
|
|
|
$table->string('name',8)->unique();
|
|
|
|
$table->string('dnsdomain')->nullable();
|
|
|
|
$table->string('notes')->nullable();
|
|
|
|
|
|
|
|
$table->boolean('active');
|
|
|
|
$table->boolean('public')->default(TRUE);
|
|
|
|
$table->text('homepage')->nullable();
|
|
|
|
});
|
2021-06-15 12:19:14 +00:00
|
|
|
|
|
|
|
Schema::create('domain_user', function (Blueprint $table) {
|
|
|
|
$table->integer('domain_id');
|
|
|
|
$table->foreign('domain_id')->references('id')->on('domains');
|
|
|
|
|
|
|
|
$table->integer('user_id');
|
|
|
|
$table->foreign('user_id')->references('id')->on('users');
|
2022-10-23 02:46:46 +00:00
|
|
|
|
|
|
|
$table->unique(['domain_id','user_id']);
|
2021-06-15 12:19:14 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
2022-10-23 02:46:46 +00:00
|
|
|
Schema::dropIfExists('domain_user');
|
|
|
|
Schema::dropIfExists('domains');
|
2021-06-15 12:19:14 +00:00
|
|
|
}
|
|
|
|
}
|