clrghouz/database/migrations/2022_10_22_001257_systems.php

63 lines
1.5 KiB
PHP
Raw Normal View History

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Systems extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('systems', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name');
$table->string('sysop');
$table->string('location');
$table->text('notes')->nullable();
$table->boolean('active');
$table->string('address')->nullable();
$table->integer('port')->nullable();
$table->integer('method')->nullable();
$table->dateTime('last_session')->nullable();
$table->string('mailer_address')->nullable();
$table->integer('mailer_port')->nullable();
$table->integer('mailer_type')->nullable();
$table->string('zt_id',10)->nullable()->unique();
$table->string('phone')->nullable();
$table->boolean('hold')->default(FALSE);
$table->unique(['mailer_type','mailer_address','mailer_port']);
});
Schema::create('system_user', function (Blueprint $table) {
$table->bigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->bigInteger('system_id');
$table->foreign('system_id')->references('id')->on('systems');
$table->unique(['system_id','user_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('system_user');
Schema::dropIfExists('systems');
}
}