clrghouz/database/migrations/2021_06_17_100152_create_systems.php

70 lines
1.9 KiB
PHP
Raw Normal View History

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSystems 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');
$table->boolean('active');
$table->string('address')->nullable();
$table->integer('port')->nullable();
$table->integer('method')->nullable();
});
Schema::create('node_system', function (Blueprint $table) {
$table->integer('node_id');
$table->foreign('node_id')->references('id')->on('nodes');
$table->integer('system_id');
$table->foreign('system_id')->references('id')->on('systems');
});
Schema::create('system_user', function (Blueprint $table) {
$table->integer('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->integer('system_id');
$table->foreign('system_id')->references('id')->on('systems');
});
Schema::table('setups', function (Blueprint $table) {
$table->dropColumn('opt_md');
$table->integer('zmodem');
$table->integer('emsi_protocols');
$table->integer('binkp');
$table->integer('protocols');
$table->integer('permissions');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('setups', function (Blueprint $table) {
$table->integer('opt_md');
$table->dropColumn(['zmodem','emsi_protocols','binkp','protocols','permissions']);
});
Schema::dropIfExists('node_system');
Schema::dropIfExists('system_user');
Schema::dropIfExists('systems');
}
}