Refactor the database, in preparation to moving to postgresql

This commit is contained in:
Deon George 2022-10-23 13:46:46 +11:00
parent 2495e4675c
commit 5745c67538
45 changed files with 530 additions and 1553 deletions

View File

@ -3,9 +3,12 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Nodelist extends Model
{
use SoftDeletes;
protected $dates = ['date'];
protected $fillable = ['date','domain_id'];

View File

@ -14,7 +14,7 @@ class CreateUsersTable extends Migration
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();

View File

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDomains extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
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('default')->default(FALSE);
$table->boolean('active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('domains');
}
}

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateZt extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('zt', function (Blueprint $table) {
$table->binary('id',10)->unique();
$table->timestamps();
$table->text('api');
$table->binary('token',24);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('zt');
}
}

View File

@ -1,52 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateZones extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('zones', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->integer('zone_id');
$table->string('description')->nullable();
$table->boolean('active');
$table->string('notes')->nullable();
$table->boolean('public')->default(TRUE);
$table->ipAddress('ipv4')->nullable();
$table->integer('ipv4_mask')->nullable();
$table->ipAddress('ipv6')->nullable();
$table->integer('ipv6_mask')->nullable();
$table->integer('domain_id')->nullable()->unique();
$table->foreign('domain_id')->references('id')->on('domains');
$table->binary('zt_id',10)->nullable()->unique();
$table->foreign('zt_id')->references('id')->on('zt');
$table->unique(['zone_id','domain_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('zones');
}
}

View File

@ -1,96 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNodes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('protocols', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('name');
$table->integer('port')->nullable();
$table->boolean('active');
});
Schema::create('software', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('name');
$table->boolean('active');
});
Schema::create('nodes', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('zone_id')->nullable()->index();
$table->foreign('zone_id')->references('id')->on('zones');
$table->integer('region_id')->nullable();
$table->integer('host_id')->nullable()->index();
$table->integer('hub_id')->nullable()->index();
$table->integer('node_id')->nullable()->index();
$table->integer('point_id')->default(0);
$table->boolean('active');
$table->string('status')->nullable();
$table->string('system');
$table->string('sysop');
$table->string('location');
$table->string('email')->nullable();
$table->string('address')->nullable();
$table->integer('port')->nullable();
$table->integer('baud')->nullable();
$table->string('phone')->nullable();
$table->string('notes')->nullable();
$table->boolean('is_zc')->default(FALSE);
$table->boolean('is_rc')->default(FALSE);
$table->boolean('is_hub')->default(FALSE);
$table->boolean('is_host')->default(FALSE);
$table->string('sespass')->nullable();
$table->string('pktpass',8)->nullable();
$table->string('ticpass')->nullable();
$table->string('fixpass')->nullable();
$table->string('zt',10)->nullable();
$table->unique(['zone_id','host_id','node_id','point_id']);
$table->unique(['zone_id','zt']);
$table->integer('protocol_id')->nullable();
$table->foreign('protocol_id')->references('id')->on('protocols');
$table->integer('software_id')->nullable();
$table->foreign('software_id')->references('id')->on('software');
// $table->unique(['zone_id','host_id','id']);
// $table->index(['zone_id','host_id']);
// $table->index(['zone_id','id']);
// $table->foreign(['zone_id','host_id'])->references(['zone_id','id'])->on('nodes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('nodes');
Schema::dropIfExists('protocols');
Schema::dropIfExists('software');
}
}

View File

@ -1,34 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFlags extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('flags');
Schema::create('flags', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('flag')->unique();
$table->string('description');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('flags');
}
}

View File

@ -1,39 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFlagNode extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('flag_node');
Schema::create('flag_node', function (Blueprint $table) {
$table->integer('flag_id');
$table->integer('node_id');
$table->string('arguments')->nullable();
$table->index('node_id');
$table->index('flag_id');
$table->unique(['node_id','flag_id']);
$table->foreign('node_id')->references('id')->on('nodes');
$table->foreign('flag_id')->references('id')->on('flags');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('flag_node');
}
}

View File

@ -1,56 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEchomail extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('echomails', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('pkt_from');
$table->integer('pkt_to');
$table->datetime('pkt_date');
$table->string('pkt');
$table->string('flags');
$table->integer('cost');
$table->string('from_user');
$table->integer('from_ftn');
$table->string('to_user');
$table->string('subject');
$table->datetime('date');
$table->string('tz')->nullable();
$table->string('area');
$table->string('msgid')->nullable();
$table->string('replyid')->nullable();
$table->text('message');
$table->string('origin');
$table->text('original')->nullable();
$table->index('pkt_from');
$table->index('pkt_to');
$table->index('from_ftn');
$table->foreign('pkt_from')->references('id')->on('nodes');
$table->foreign('pkt_to')->references('id')->on('nodes');
$table->foreign('from_ftn')->references('id')->on('nodes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('echomails');
}
}

View File

@ -1,62 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEchomailTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('echomail_kludge', function (Blueprint $table) {
$table->integer('echomail_id');
$table->string('kludge_id')->nullable();
$table->json('value');
$table->index('echomail_id');
$table->foreign('echomail_id')->references('id')->on('echomails');
});
Schema::create('echomail_seenby', function (Blueprint $table) {
$table->integer('echomail_id');
$table->integer('node_id');
$table->unique(['echomail_id','node_id']);
$table->index('echomail_id');
$table->foreign('echomail_id')->references('id')->on('echomails');
$table->index('node_id');
$table->foreign('node_id')->references('id')->on('nodes');
});
Schema::create('echomail_path', function (Blueprint $table) {
$table->integer('echomail_id');
$table->integer('node_id');
$table->integer('sequence');
$table->unique(['echomail_id','sequence']);
$table->index('echomail_id');
$table->foreign('echomail_id')->references('id')->on('echomails');
$table->index('node_id');
$table->foreign('node_id')->references('id')->on('nodes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('echomail_path');
Schema::dropIfExists('echomail_seenby');
Schema::dropIfExists('echomail_kludge');
}
}

View File

@ -1,60 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNetmail extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('netmails', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('pkt_from');
$table->integer('pkt_to');
$table->datetime('pkt_date');
$table->string('pkt');
$table->string('flags');
$table->integer('cost');
$table->string('from_user');
$table->integer('from_ftn');
$table->string('to_user');
$table->integer('to_ftn');
$table->string('subject');
$table->datetime('date');
$table->string('tz')->nullable();
$table->string('msgid')->nullable();
$table->string('replyid')->nullable();
$table->text('message');
$table->string('origin');
$table->text('original')->nullable();
$table->index('pkt_from');
$table->index('pkt_to');
$table->index('from_ftn');
$table->index('to_ftn');
$table->foreign('pkt_from')->references('id')->on('nodes');
$table->foreign('pkt_to')->references('id')->on('nodes');
$table->foreign('from_ftn')->references('id')->on('nodes');
$table->foreign('to_ftn')->references('id')->on('nodes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('netmails');
}
}

View File

@ -1,50 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNetmailTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kludge_netmail', function (Blueprint $table) {
$table->integer('netmail_id');
$table->string('kludge_id')->nullable();
$table->json('value');
$table->index('netmail_id');
$table->foreign('netmail_id')->references('id')->on('netmails');
});
Schema::create('netmail_path', function (Blueprint $table) {
$table->integer('netmail_id');
$table->integer('node_id');
$table->integer('sequence');
$table->json('value');
$table->unique(['netmail_id','sequence']);
$table->index('netmail_id');
$table->foreign('netmail_id')->references('id')->on('netmails');
$table->index('node_id');
$table->foreign('node_id')->references('id')->on('nodes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('netmail_path');
Schema::dropIfExists('kludge_netmail');
}
}

View File

@ -1,41 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSetup extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setups', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->integer('opt_md');
});
Schema::create('node_setup', function (Blueprint $table) {
$table->integer('node_id');
$table->foreign('node_id')->references('id')->on('nodes');
$table->integer('setup_id');
$table->foreign('setup_id')->references('id')->on('setups');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('node_setup');
Schema::dropIfExists('setups');
}
}

View File

@ -1,40 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPublicToDomains extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('domains', function (Blueprint $table) {
$table->boolean('public')->default(TRUE);
$table->text('homepage')->nullable();
});
Schema::table('zones', function (Blueprint $table) {
$table->dropColumn('public');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('domains', function (Blueprint $table) {
$table->dropColumn(['public','homepage']);
});
Schema::table('zones', function (Blueprint $table) {
$table->boolean('public')->default(TRUE);
});
}
}

View File

@ -1,69 +0,0 @@
<?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');
}
}

View File

@ -1,49 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateZones extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('ALTER TABLE zones ALTER COLUMN domain_id SET NOT NULL');
Schema::table('zones', function (Blueprint $table) {
$table->integer('system_id');
$table->dropColumn(['description','ipv4','ipv4_mask','ipv6','ipv6_mask','zt_id']);
$table->string('ztid')->nullable();
$table->dropUnique(['domain_id']);
$table->foreign('system_id')->references('id')->on('systems');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('ALTER TABLE zones ALTER COLUMN domain_id DROP NOT NULL');
Schema::table('zones', function (Blueprint $table) {
$table->dropForeign(['system_id']);
$table->dropColumn(['system_id','ztid']);
$table->unique('domain_id');
$table->string('description');
$table->ipAddress('ipv4')->nullable();
$table->integer('ipv4_mask')->nullable();
$table->ipAddress('ipv6')->nullable();
$table->integer('ipv6_mask')->nullable();
$table->binary('zt_id')->nullable()->unique();
});
}
}

View File

@ -14,13 +14,11 @@ class UpdateUsers extends Migration
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('admin')->nullable();
$table->text('pgp_pubkey')->nullable();
$table->boolean('active')->default(TRUE);
$table->dateTime('last_on')->nullable();
});
Schema::table('systems', function (Blueprint $table) {
$table->dateTime('last_session')->nullable();
$table->string('alias')->nullable();
});
}
@ -32,11 +30,8 @@ class UpdateUsers extends Migration
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['pgp_pubkey','active','last_on']);
});
Schema::table('systems', function (Blueprint $table) {
$table->dropColumn(['last_session']);
$table->dropColumn(['admin','pgp_pubkey','active','last_on']);
});
}
}

View File

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class FixSystems extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('ALTER TABLE systems ALTER COLUMN notes DROP NOT NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Noop
}
}

View File

@ -1,49 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAddresses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('addresses', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->boolean('active');
$table->integer('zone_id');
$table->foreign('zone_id')->references('id')->on('zones');
$table->integer('region_id')->nullable();
$table->integer('host_id')->nullable();
$table->integer('node_id');
$table->integer('point_id');
$table->integer('status')->nullable(); // @note Used to record Down/Private/Pending, etc
$table->integer('role')->nullable();
$table->integer('system_id');
$table->foreign('system_id')->references('id')->on('systems');
$table->unique(['zone_id','region_id','host_id','node_id']);
$table->unique(['zone_id','host_id','node_id','point_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('addresses');
}
}

View File

@ -1,50 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UniqueRelations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('node_setup', function (Blueprint $table) {
$table->unique(['node_id','setup_id']);
});
Schema::table('domain_user', function (Blueprint $table) {
$table->unique(['domain_id','user_id']);
});
Schema::table('node_system', function (Blueprint $table) {
$table->unique(['node_id','system_id']);
});
Schema::table('system_user', function (Blueprint $table) {
$table->unique(['system_id','user_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('node_setup', function (Blueprint $table) {
$table->dropUnique(['node_id','setup_id']);
});
Schema::table('domain_user', function (Blueprint $table) {
$table->dropUnique(['domain_id','user_id']);
});
Schema::table('node_system', function (Blueprint $table) {
$table->dropUnique(['node_id','system_id']);
});
Schema::table('system_user', function (Blueprint $table) {
$table->dropUnique(['system_id','user_id']);
});
}
}

View File

@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSystemToSetups extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setups', function (Blueprint $table) {
$table->integer('system_id');
$table->integer('options');
$table->foreign('system_id')->references('id')->on('systems');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('setups', function (Blueprint $table) {
$table->dropForeign(['system_id']);
$table->dropColumn(['system_id','options']);
});
}
}

View File

@ -1,86 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddMailerToSystem extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('systems', function (Blueprint $table) {
$table->string('mailer_address')->nullable();
$table->integer('mailer_port')->nullable();
$table->integer('mailer_type')->nullable();
$table->string('zt_id',10)->nullable()->unique();
$table->unique(['mailer_type','mailer_address','mailer_port']);
});
Schema::table('zones', function (Blueprint $table) {
$table->dropColumn(['ztid']);
});
Schema::table('zones', function (Blueprint $table) {
$table->string('zt_id',16)->unique()->nullable();
$table->ipAddress('zt_ipv4')->nullable();
$table->integer('zt_ipv4_mask')->nullable();
$table->unique(['zt_ipv4','zt_ipv4_mask']);
$table->ipAddress('zt_ipv6')->nullable();
$table->integer('zt_ipv6_mask')->nullable();
$table->unique(['zt_ipv6','zt_ipv6_mask']);
});
Schema::create('address_zone', function (Blueprint $table) {
$table->string('sespass')->nullable();
$table->string('pktpass',8)->nullable();
$table->string('ticpass')->nullable();
$table->string('fixpass')->nullable();
$table->ipAddress('zt_ipv4')->nullable();
$table->ipAddress('zt_ipv6')->nullable();
$table->integer('system_id');
$table->foreign('system_id')->references('id')->on('systems');
$table->integer('zone_id');
$table->foreign('zone_id')->references('id')->on('zones');
$table->unique(['system_id','zone_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('address_zone');
Schema::table('zones', function (Blueprint $table) {
$table->dropUnique(['zt_id']);
$table->dropColumn(['zt_id']);
$table->dropUnique(['zt_ipv4','zt_ipv4_mask']);
$table->dropUnique(['zt_ipv6','zt_ipv6_mask']);
$table->dropColumn(['zt_ipv4','zt_ipv4_mask']);
$table->dropColumn(['zt_ipv6','zt_ipv6_mask']);
});
Schema::table('zones', function (Blueprint $table) {
$table->string('ztid')->nullable();
});
Schema::table('systems', function (Blueprint $table) {
$table->dropUnique(['zt_id']);
$table->dropUnique(['mailer_type','mailer_address','mailer_port']);
$table->dropColumn(['mailer_address','mailer_port','mailer_type','zt_id']);
});
}
}

View File

@ -1,46 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSoftdeletesToAddresses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('addresses', function (Blueprint $table) {
$table->dropUnique(['zone_id','region_id','host_id','node_id']);
$table->dropUnique(['zone_id','host_id','node_id','point_id']);
$table->integer('hub_id')->nullable();
$table->foreign('hub_id')->references('id')->on('addresses');
$table->softDeletes();
});
DB::statement("ALTER TABLE addresses ALTER COLUMN region_id set NOT NULL");
DB::statement("ALTER TABLE addresses ALTER COLUMN host_id set NOT NULL");
DB::statement("CREATE UNIQUE INDEX active_addresses ON addresses (zone_id,region_id,host_id,node_id,point_id) WHERE active = true");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('addresses', function (Blueprint $table) {
$table->dropSoftDeletes();
$table->dropForeign(['hub_id']);
$table->dropColumn('hub_id');
$table->dropIndex('active_addresses');
$table->unique(['zone_id','region_id','host_id','node_id']);
$table->unique(['zone_id','host_id','node_id','point_id']);
});
}
}

View File

@ -1,37 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCodeToSoftware extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('software', function (Blueprint $table) {
$table->integer('code')->nullable(); // Mailer/Tosser Product Code
$table->integer('type'); // Mailer/Tosser
$table->unique(['code','type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('software', function (Blueprint $table) {
$table->dropUnique(['code','type']);
$table->dropColumn('code');
$table->dropColumn('type');
});
}
}

View File

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SessionPasswords extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('ALTER TABLE address_zone RENAME TO system_zone');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('ALTER TABLE system_zone RENAME TO address_zone');
}
}

View File

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DefaultRoute extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('system_zone', function (Blueprint $table) {
$table->boolean('default')->nullable();
});
DB::statement('CREATE UNIQUE INDEX default_zone ON system_zone (zone_id) WHERE "default" = true');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("DROP INDEX default_zone");
Schema::table('system_zone', function (Blueprint $table) {
$table->dropColumn('default');
});
}
}

View File

@ -1,44 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DefaultZones extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('domains', function (Blueprint $table) {
$table->dropColumn('default');
});
Schema::table('zones', function (Blueprint $table) {
$table->boolean('default')->default(FALSE);
});
DB::statement('CREATE UNIQUE INDEX default_zones ON zones (zone_id) WHERE "default" = true');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("DROP INDEX default_zones");
Schema::table('zones', function (Blueprint $table) {
$table->dropColumn('default');
});
Schema::table('domains', function (Blueprint $table) {
$table->boolean('default')->default(FALSE);
});
}
}

View File

@ -1,39 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class EchomailExport extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('address_echomail', function (Blueprint $table) {
$table->string('echomail_id');
$table->integer('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->datetime('export_date');
$table->datetime('sent_date')->nullable();
$table->unique(['address_id','echomail_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('address_echomail');
}
}

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAliasToUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('alias')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('alias');
});
}
}

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddValidated extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('addresses', function (Blueprint $table) {
$table->boolean('validated')->default(FALSE);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('addresses', function (Blueprint $table) {
$table->dropColumn('validated');
});
}
}

View File

@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropNode extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('echomail_kludge');
Schema::dropIfExists('echomail_path');
Schema::dropIfExists('echomail_seenby');
Schema::dropIfExists('kludge_netmail');
Schema::dropIfExists('netmail_path');
Schema::dropIfExists('flag_node');
Schema::dropIfExists('kludges');
Schema::dropIfExists('paths');
Schema::dropIfExists('seenbys');
Schema::dropIfExists('flags');
Schema::dropIfExists('echomails');
Schema::dropIfExists('netmails');
Schema::dropIfExists('node_setup');
Schema::dropIfExists('node_system');
Schema::dropIfExists('nodes');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,137 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMail extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('echomails', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('mid')->nullable();
$table->string('to',128);
$table->string('from',128);
$table->string('subject',256);
$table->dateTimeTz('datetime');
$table->tinyInteger('tzoffset');
$table->string('msgid')->nullable();
$table->string('replyid')->nullable();
$table->text('msg');
$table->text('msg_src')->nullable();
$table->string('msg_crc')->nullable();
$table->string('tagline')->nullable();
$table->string('tearline')->nullable();
$table->string('origin')->nullable();
$table->tinyInteger('flags')->nullable();
$table->jsonb('rogue_path')->nullable();
$table->jsonb('rogue_seenby')->nullable();
$table->jsonb('kludges')->nullable();
$table->integer('echoarea_id');
$table->foreign('echoarea_id')->references('id')->on('echoareas');
$table->integer('fftn_id');
$table->foreign('fftn_id')->references('id')->on('addresses');
});
DB::statement("ALTER TABLE address_echomail RENAME COLUMN echomail_id TO mid");
DB::statement("ALTER TABLE address_echomail ALTER COLUMN mid DROP NOT NULL");
DB::statement("ALTER TABLE address_echomail RENAME COLUMN export_date TO export_at");
DB::statement("ALTER TABLE address_echomail ALTER COLUMN export_at DROP NOT NULL");
DB::statement("ALTER TABLE address_echomail RENAME COLUMN sent_date TO sent_at");
DB::statement("ALTER TABLE address_echomail RENAME TO echomail_seenby");
Schema::table('echomail_seenby', function (Blueprint $table) {
$table->integer('echomail_id')->nullable()->first();
$table->string('packet')->nullable();
$table->foreign('echomail_id')->references('id')->on('echomails');
});
Schema::create('echomail_path', function (Blueprint $table) {
$table->id();
$table->integer('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['id','echomail_id']);
$table->unique(['echomail_id','address_id','parent_id']);
$table->integer('parent_id')->nullable();
$table->foreign(['parent_id','echomail_id'])->references(['id','echomail_id'])->on('echomail_path');
$table->integer('echomail_id');
$table->foreign('echomail_id')->references('id')->on('echomails');
});
Schema::create('netmails', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('mid')->nullable();
$table->string('to',128);
$table->string('from',128);
$table->string('subject',256);
$table->dateTimeTz('datetime');
$table->tinyInteger('tzoffset')->nullable();
$table->tinyInteger('flags')->nullable();
$table->tinyInteger('cost')->nullable();
$table->string('msgid')->nullable();
$table->string('replyid')->nullable();
$table->text('msg');
$table->text('msg_src')->nullable();
$table->string('msg_crc')->nullable();
$table->string('tagline')->nullable();
$table->string('tearline')->nullable();
$table->boolean('local')->default(FALSE);
$table->string('recv_pkt')->nullable();
$table->string('sent_pkt')->nullable();
$table->dateTimeTz('sent_at')->nullable();
$table->integer('fftn_id');
$table->integer('tftn_id');
$table->foreign('fftn_id')->references('id')->on('addresses');
$table->foreign('tftn_id')->references('id')->on('addresses');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('echomail_seenby', function (Blueprint $table) {
$table->dropForeign(['echomail_id']);
$table->dropColumn(['packet','echomail_id']);
});
DB::commit();
DB::statement("ALTER TABLE echomail_seenby RENAME TO address_echomail");
DB::statement("ALTER TABLE address_echomail RENAME COLUMN mid TO echomail_id;");
DB::statement("ALTER TABLE address_echomail RENAME COLUMN export_at TO export_date;");
DB::statement("ALTER TABLE address_echomail RENAME COLUMN sent_at TO sent_date;");
Schema::dropIfExists('echomail_path');
Schema::dropIfExists('echomails');
Schema::dropIfExists('netmails');
}
}

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SystemMailHold extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('systems', function (Blueprint $table) {
$table->boolean('hold')->default(FALSE);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('systems', function (Blueprint $table) {
$table->dropColumn(['hold']);
});
}
}

View File

@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddressRoleNotnull extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
\App\Models\Address::whereNull('role')->withTrashed()->update(['role'=>\App\Models\Address::NODE_ACTIVE]);
DB::commit();
DB::statement("ALTER TABLE addresses ALTER COLUMN role set NOT NULL");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("ALTER TABLE addresses ALTER COLUMN role drop NOT NULL");
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAdminToUsers extends Migration
class Domains extends Migration
{
/**
* Run the migrations.
@ -13,8 +13,16 @@ class AddAdminToUsers extends Migration
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('admin')->nullable();
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();
});
Schema::create('domain_user', function (Blueprint $table) {
@ -23,6 +31,8 @@ class AddAdminToUsers extends Migration
$table->integer('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->unique(['domain_id','user_id']);
});
}
@ -33,10 +43,7 @@ class AddAdminToUsers extends Migration
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('admin');
});
Schema::dropIfExists('domain_user');
Schema::dropIfExists('domains');
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPhone extends Migration
class Zt extends Migration
{
/**
* Run the migrations.
@ -13,8 +13,11 @@ class AddPhone extends Migration
*/
public function up()
{
Schema::table('systems', function (Blueprint $table) {
$table->string('phone')->nullable();
Schema::create('zt', function (Blueprint $table) {
$table->binary('id',10)->unique();
$table->timestamps();
$table->text('api');
$table->binary('token',24);
});
}
@ -25,8 +28,6 @@ class AddPhone extends Migration
*/
public function down()
{
Schema::table('systems', function (Blueprint $table) {
$table->dropColumn('phone');
});
Schema::dropIfExists('zt');
}
}

View File

@ -0,0 +1,62 @@
<?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');
}
}

View File

@ -0,0 +1,81 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Zones extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('zones', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->integer('zone_id');
$table->boolean('active');
$table->string('notes')->nullable();
$table->bigInteger('domain_id');
$table->foreign('domain_id')->references('id')->on('domains');
$table->unique(['zone_id','domain_id']);
$table->bigInteger('system_id');
$table->foreign('system_id')->references('id')->on('systems');
$table->string('zt_id',16)->unique()->nullable();
$table->ipAddress('zt_ipv4')->nullable();
$table->integer('zt_ipv4_mask')->nullable();
$table->unique(['zt_ipv4','zt_ipv4_mask']);
$table->ipAddress('zt_ipv6')->nullable();
$table->integer('zt_ipv6_mask')->nullable();
$table->unique(['zt_ipv6','zt_ipv6_mask']);
$table->boolean('default')->default(FALSE);
});
DB::statement('CREATE UNIQUE INDEX default_zones ON zones (zone_id) WHERE "default" = true');
Schema::create('system_zone', function (Blueprint $table) {
$table->string('sespass')->nullable();
$table->string('pktpass',8)->nullable();
$table->string('ticpass')->nullable();
$table->string('fixpass')->nullable();
$table->ipAddress('zt_ipv4')->nullable();
$table->ipAddress('zt_ipv6')->nullable();
$table->bigInteger('system_id');
$table->foreign('system_id')->references('id')->on('systems');
$table->bigInteger('zone_id');
$table->foreign('zone_id')->references('id')->on('zones');
$table->unique(['system_id','zone_id']);
$table->boolean('default')->nullable();
});
DB::statement('CREATE UNIQUE INDEX default_zone ON system_zone (zone_id) WHERE "default" = true');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('system_zone');
Schema::dropIfExists('zones');
}
}

View File

@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Addresses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('addresses', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->boolean('active');
$table->boolean('validated')->default(FALSE);
$table->bigInteger('zone_id');
$table->foreign('zone_id')->references('id')->on('zones');
$table->integer('region_id');
$table->integer('host_id');
$table->integer('node_id');
$table->integer('point_id');
$table->integer('status')->nullable(); // @note Used to record Down/Private/Pending, etc
$table->integer('role');
$table->bigInteger('system_id');
$table->foreign('system_id')->references('id')->on('systems');
$table->bigInteger('hub_id')->nullable();
$table->foreign('hub_id')->references('id')->on('addresses');
$table->softDeletes();
});
DB::statement("CREATE UNIQUE INDEX active_addresses ON addresses (zone_id,region_id,host_id,node_id,point_id) WHERE active = true");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('address_echomail');
Schema::dropIfExists('addresses');
}
}

View File

@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ProtocolsSoftware extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('protocols', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name');
$table->integer('port')->nullable();
$table->boolean('active');
});
Schema::create('software', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name');
$table->boolean('active');
$table->integer('code')->nullable(); // Mailer/Tosser Product Code
$table->integer('type'); // Mailer/Tosser
$table->unique(['code','type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('protocols');
Schema::dropIfExists('software');
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Echomail extends Migration
class Echoarea extends Migration
{
/**
* Run the migrations.
@ -23,7 +23,7 @@ class Echomail extends Migration
$table->boolean('public');
$table->string('notes')->nullable();
$table->integer('domain_id');
$table->bigInteger('domain_id');
$table->foreign('domain_id')->references('id')->on('domains');
});
@ -37,27 +37,31 @@ class Echomail extends Migration
$table->boolean('public');
$table->string('notes')->nullable();
$table->integer('domain_id');
$table->bigInteger('domain_id');
$table->foreign('domain_id')->references('id')->on('domains');
});
Schema::create('address_echoarea', function (Blueprint $table) {
$table->integer('echoarea_id');
$table->bigInteger('echoarea_id');
$table->foreign('echoarea_id')->references('id')->on('echoareas');
$table->integer('address_id');
$table->bigInteger('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['echoarea_id','address_id']);
$table->dateTime('subscribed');
});
Schema::create('address_filearea', function (Blueprint $table) {
$table->integer('filearea_id');
$table->bigInteger('filearea_id');
$table->foreign('filearea_id')->references('id')->on('fileareas');
$table->integer('address_id');
$table->bigInteger('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['filearea_id','address_id']);
$table->dateTime('subscribed');
});
}
@ -69,13 +73,10 @@ class Echomail extends Migration
*/
public function down()
{
Schema::dropIfExists('address_file');
Schema::dropIfExists('address_echomail');
Schema::dropIfExists('address_filearea');
Schema::dropIfExists('fileareas');
Schema::dropIfExists('address_echoarea');
Schema::dropIfExists('fileareas');
Schema::dropIfExists('echoareas');
}
}

View File

@ -0,0 +1,92 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Echomails extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('echomails', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('mid')->nullable();
$table->string('to',128);
$table->string('from',128);
$table->string('subject',256);
$table->dateTimeTz('datetime');
$table->tinyInteger('tzoffset');
$table->string('msgid')->nullable();
$table->string('replyid')->nullable();
$table->text('msg');
$table->text('msg_src')->nullable();
$table->string('msg_crc')->nullable();
$table->string('tagline')->nullable();
$table->string('tearline')->nullable();
$table->string('origin')->nullable();
$table->tinyInteger('flags')->nullable();
$table->jsonb('rogue_path')->nullable();
$table->jsonb('rogue_seenby')->nullable();
$table->jsonb('kludges')->nullable();
$table->bigInteger('echoarea_id');
$table->foreign('echoarea_id')->references('id')->on('echoareas');
$table->bigInteger('fftn_id');
$table->foreign('fftn_id')->references('id')->on('addresses');
});
Schema::create('echomail_seenby', function (Blueprint $table) {
$table->bigInteger('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->bigInteger('echomail_id');
$table->foreign('echomail_id')->references('id')->on('echomails');
$table->string('mid')->nullable();
$table->datetime('export_at')->nullable();
$table->datetime('sent_at')->nullable();
$table->string('packet')->nullable();
$table->unique(['address_id','echomail_id']);
});
Schema::create('echomail_path', function (Blueprint $table) {
$table->id();
$table->bigInteger('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['id','echomail_id']);
$table->unique(['echomail_id','address_id','parent_id']);
$table->bigInteger('parent_id')->nullable();
$table->foreign(['parent_id','echomail_id'])->references(['id','echomail_id'])->on('echomail_path');
$table->bigInteger('echomail_id');
$table->foreign('echomail_id')->references('id')->on('echomails');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('echomail_path');
Schema::dropIfExists('echomails');
}
}

View File

@ -0,0 +1,88 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Netmails extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('netmails', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('mid')->nullable();
$table->string('to',128);
$table->string('from',128);
$table->string('subject',256);
$table->dateTimeTz('datetime');
$table->tinyInteger('tzoffset')->nullable();
$table->tinyInteger('flags')->nullable();
$table->tinyInteger('cost')->nullable();
$table->string('msgid')->nullable();
$table->string('replyid')->nullable();
$table->text('msg');
$table->text('msg_src')->nullable();
$table->string('msg_crc')->nullable();
$table->string('tagline')->nullable();
$table->string('tearline')->nullable();
$table->boolean('local')->default(FALSE);
$table->string('recv_pkt')->nullable();
$table->string('sent_pkt')->nullable();
$table->dateTimeTz('sent_at')->nullable();
$table->bigInteger('fftn_id');
$table->bigInteger('tftn_id');
$table->foreign('fftn_id')->references('id')->on('addresses');
$table->foreign('tftn_id')->references('id')->on('addresses');
});
/*
Schema::create('kludge_netmail', function (Blueprint $table) {
$table->bigInteger('netmail_id');
$table->string('kludge_id')->nullable();
$table->json('value');
$table->foreign('netmail_id')->references('id')->on('netmails');
});
*/
/*
Schema::create('netmail_path', function (Blueprint $table) {
$table->integer('sequence');
$table->json('value');
$table->unique(['netmail_id','sequence']);
$table->bigInteger('netmail_id');
$table->foreign('netmail_id')->references('id')->on('netmails');
$table->bigInteger('node_id');
$table->foreign('node_id')->references('id')->on('nodes');
});
*/
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('netmail_path');
Schema::dropIfExists('kludge_netmail');
Schema::dropIfExists('netmails');
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Setup extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setups', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->integer('zmodem');
$table->integer('emsi_protocols');
$table->integer('binkp');
$table->integer('protocols');
$table->integer('permissions');
$table->integer('options');
$table->bigInteger('system_id');
$table->foreign('system_id')->references('id')->on('systems');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setups');
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNodelist extends Migration
class Nodelists extends Migration
{
/**
* Run the migrations.
@ -21,6 +21,8 @@ class CreateNodelist extends Migration
$table->foreign('domain_id')->references('id')->on('domains');
$table->unique(['date','domain_id']);
$table->softDeletes();
});
Schema::create('address_nodelist', function (Blueprint $table) {