diff --git a/app/Models/Nodelist.php b/app/Models/Nodelist.php index 063f01a..975c0e4 100644 --- a/app/Models/Nodelist.php +++ b/app/Models/Nodelist.php @@ -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']; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index e2dc6f2..d63b488 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -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(); diff --git a/database/migrations/2019_04_16_090345_create_domains.php b/database/migrations/2019_04_16_090345_create_domains.php deleted file mode 100644 index 4c2a96b..0000000 --- a/database/migrations/2019_04_16_090345_create_domains.php +++ /dev/null @@ -1,36 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2019_04_16_105252_create_zt.php b/database/migrations/2019_04_16_105252_create_zt.php deleted file mode 100644 index 4859b05..0000000 --- a/database/migrations/2019_04_16_105252_create_zt.php +++ /dev/null @@ -1,33 +0,0 @@ -binary('id',10)->unique(); - $table->timestamps(); - $table->text('api'); - $table->binary('token',24); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('zt'); - } -} diff --git a/database/migrations/2019_04_16_105253_create_zones.php b/database/migrations/2019_04_16_105253_create_zones.php deleted file mode 100644 index 81a6a92..0000000 --- a/database/migrations/2019_04_16_105253_create_zones.php +++ /dev/null @@ -1,52 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2019_04_16_105254_create_nodes.php b/database/migrations/2019_04_16_105254_create_nodes.php deleted file mode 100644 index dff0c8b..0000000 --- a/database/migrations/2019_04_16_105254_create_nodes.php +++ /dev/null @@ -1,96 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2019_04_16_105255_create_flags.php b/database/migrations/2019_04_16_105255_create_flags.php deleted file mode 100644 index e6f2ff6..0000000 --- a/database/migrations/2019_04_16_105255_create_flags.php +++ /dev/null @@ -1,34 +0,0 @@ -increments('id'); - $table->timestamps(); - $table->string('flag')->unique(); - $table->string('description'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('flags'); - } -} diff --git a/database/migrations/2019_04_16_105256_create_flag_node.php b/database/migrations/2019_04_16_105256_create_flag_node.php deleted file mode 100644 index b27d0f5..0000000 --- a/database/migrations/2019_04_16_105256_create_flag_node.php +++ /dev/null @@ -1,39 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2019_04_26_112227_create_echomail.php b/database/migrations/2019_04_26_112227_create_echomail.php deleted file mode 100644 index aeeaa50..0000000 --- a/database/migrations/2019_04_26_112227_create_echomail.php +++ /dev/null @@ -1,56 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2019_04_26_112228_create_echomail_tables.php b/database/migrations/2019_04_26_112228_create_echomail_tables.php deleted file mode 100644 index ed061b5..0000000 --- a/database/migrations/2019_04_26_112228_create_echomail_tables.php +++ /dev/null @@ -1,62 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2019_04_26_112307_create_netmail.php b/database/migrations/2019_04_26_112307_create_netmail.php deleted file mode 100644 index 74fcb41..0000000 --- a/database/migrations/2019_04_26_112307_create_netmail.php +++ /dev/null @@ -1,60 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2019_04_26_113128_create_netmail_tables.php b/database/migrations/2019_04_26_113128_create_netmail_tables.php deleted file mode 100644 index 4c0199b..0000000 --- a/database/migrations/2019_04_26_113128_create_netmail_tables.php +++ /dev/null @@ -1,50 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2021_05_03_104554_create_setup.php b/database/migrations/2021_05_03_104554_create_setup.php deleted file mode 100644 index 71405ac..0000000 --- a/database/migrations/2021_05_03_104554_create_setup.php +++ /dev/null @@ -1,41 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2021_06_14_064423_add_public_to_domains.php b/database/migrations/2021_06_14_064423_add_public_to_domains.php deleted file mode 100644 index ddc2a43..0000000 --- a/database/migrations/2021_06_14_064423_add_public_to_domains.php +++ /dev/null @@ -1,40 +0,0 @@ -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); - }); - } -} diff --git a/database/migrations/2021_06_17_100152_create_systems.php b/database/migrations/2021_06_17_100152_create_systems.php deleted file mode 100644 index 4bb5646..0000000 --- a/database/migrations/2021_06_17_100152_create_systems.php +++ /dev/null @@ -1,69 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2021_06_18_112022_update_zones.php b/database/migrations/2021_06_18_112022_update_zones.php deleted file mode 100644 index a240c0b..0000000 --- a/database/migrations/2021_06_18_112022_update_zones.php +++ /dev/null @@ -1,49 +0,0 @@ -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(); - }); - } -} diff --git a/database/migrations/2021_06_18_133000_update_users.php b/database/migrations/2021_06_18_133000_update_users.php index 98db015..4eebbac 100644 --- a/database/migrations/2021_06_18_133000_update_users.php +++ b/database/migrations/2021_06_18_133000_update_users.php @@ -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']); }); } } diff --git a/database/migrations/2021_06_19_043425_fix_systems.php b/database/migrations/2021_06_19_043425_fix_systems.php deleted file mode 100644 index 0c40af9..0000000 --- a/database/migrations/2021_06_19_043425_fix_systems.php +++ /dev/null @@ -1,28 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2021_06_20_124638_unique_relations.php b/database/migrations/2021_06_20_124638_unique_relations.php deleted file mode 100644 index 2fc1565..0000000 --- a/database/migrations/2021_06_20_124638_unique_relations.php +++ /dev/null @@ -1,50 +0,0 @@ -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']); - }); - } -} diff --git a/database/migrations/2021_06_21_121910_add_system_to_setups.php b/database/migrations/2021_06_21_121910_add_system_to_setups.php deleted file mode 100644 index 5882422..0000000 --- a/database/migrations/2021_06_21_121910_add_system_to_setups.php +++ /dev/null @@ -1,35 +0,0 @@ -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']); - }); - } -} diff --git a/database/migrations/2021_06_22_125420_add_mailer_to_system.php b/database/migrations/2021_06_22_125420_add_mailer_to_system.php deleted file mode 100644 index d9a0c30..0000000 --- a/database/migrations/2021_06_22_125420_add_mailer_to_system.php +++ /dev/null @@ -1,86 +0,0 @@ -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']); - }); - } -} diff --git a/database/migrations/2021_06_25_035054_add_softdeletes_to_addresses.php b/database/migrations/2021_06_25_035054_add_softdeletes_to_addresses.php deleted file mode 100644 index 0de967b..0000000 --- a/database/migrations/2021_06_25_035054_add_softdeletes_to_addresses.php +++ /dev/null @@ -1,46 +0,0 @@ -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']); - }); - } -} diff --git a/database/migrations/2021_06_28_125054_add_code_to_software.php b/database/migrations/2021_06_28_125054_add_code_to_software.php deleted file mode 100644 index b64b1df..0000000 --- a/database/migrations/2021_06_28_125054_add_code_to_software.php +++ /dev/null @@ -1,37 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2021_07_02_143145_session_passwords.php b/database/migrations/2021_07_02_143145_session_passwords.php deleted file mode 100644 index 0923674..0000000 --- a/database/migrations/2021_07_02_143145_session_passwords.php +++ /dev/null @@ -1,28 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2021_08_15_134329_default_zones.php b/database/migrations/2021_08_15_134329_default_zones.php deleted file mode 100644 index a6d18f0..0000000 --- a/database/migrations/2021_08_15_134329_default_zones.php +++ /dev/null @@ -1,44 +0,0 @@ -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); - }); - } -} diff --git a/database/migrations/2021_08_22_110731_echomail_export.php b/database/migrations/2021_08_22_110731_echomail_export.php deleted file mode 100644 index c375007..0000000 --- a/database/migrations/2021_08_22_110731_echomail_export.php +++ /dev/null @@ -1,39 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2021_10_19_105854_add_alias_to_user.php b/database/migrations/2021_10_19_105854_add_alias_to_user.php deleted file mode 100644 index 026e056..0000000 --- a/database/migrations/2021_10_19_105854_add_alias_to_user.php +++ /dev/null @@ -1,32 +0,0 @@ -string('alias')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('users', function (Blueprint $table) { - $table->dropColumn('alias'); - }); - } -} diff --git a/database/migrations/2021_11_26_114344_add_validated.php b/database/migrations/2021_11_26_114344_add_validated.php deleted file mode 100644 index fc956b8..0000000 --- a/database/migrations/2021_11_26_114344_add_validated.php +++ /dev/null @@ -1,32 +0,0 @@ -boolean('validated')->default(FALSE); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('addresses', function (Blueprint $table) { - $table->dropColumn('validated'); - }); - } -} diff --git a/database/migrations/2021_12_24_101812_drop_node.php b/database/migrations/2021_12_24_101812_drop_node.php deleted file mode 100644 index 7a62571..0000000 --- a/database/migrations/2021_12_24_101812_drop_node.php +++ /dev/null @@ -1,42 +0,0 @@ -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'); - } -} diff --git a/database/migrations/2022_01_15_112024_system_mail_hold.php b/database/migrations/2022_01_15_112024_system_mail_hold.php deleted file mode 100644 index f1798a1..0000000 --- a/database/migrations/2022_01_15_112024_system_mail_hold.php +++ /dev/null @@ -1,32 +0,0 @@ -boolean('hold')->default(FALSE); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('systems', function (Blueprint $table) { - $table->dropColumn(['hold']); - }); - } -} diff --git a/database/migrations/2022_01_24_104549_address_role_notnull.php b/database/migrations/2022_01_24_104549_address_role_notnull.php deleted file mode 100644 index 017da4a..0000000 --- a/database/migrations/2022_01_24_104549_address_role_notnull.php +++ /dev/null @@ -1,30 +0,0 @@ -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"); - } -} diff --git a/database/migrations/2021_06_14_114942_add_admin_to_users.php b/database/migrations/2022_10_22_000951_domains.php similarity index 55% rename from database/migrations/2021_06_14_114942_add_admin_to_users.php rename to database/migrations/2022_10_22_000951_domains.php index fed48ab..69c0cf9 100644 --- a/database/migrations/2021_06_14_114942_add_admin_to_users.php +++ b/database/migrations/2022_10_22_000951_domains.php @@ -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,9 +13,17 @@ 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) { $table->integer('domain_id'); @@ -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('domain_user'); + Schema::dropIfExists('domains'); } } diff --git a/database/migrations/2021_08_21_134156_add_phone.php b/database/migrations/2022_10_22_001214_zt.php similarity index 61% rename from database/migrations/2021_08_21_134156_add_phone.php rename to database/migrations/2022_10_22_001214_zt.php index dfb4dac..ad71bb1 100644 --- a/database/migrations/2021_08_21_134156_add_phone.php +++ b/database/migrations/2022_10_22_001214_zt.php @@ -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'); } } diff --git a/database/migrations/2022_10_22_001257_systems.php b/database/migrations/2022_10_22_001257_systems.php new file mode 100644 index 0000000..a6fa36f --- /dev/null +++ b/database/migrations/2022_10_22_001257_systems.php @@ -0,0 +1,62 @@ +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'); + } +} diff --git a/database/migrations/2022_10_22_001258_zones.php b/database/migrations/2022_10_22_001258_zones.php new file mode 100644 index 0000000..dd32586 --- /dev/null +++ b/database/migrations/2022_10_22_001258_zones.php @@ -0,0 +1,81 @@ +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'); + } +} diff --git a/database/migrations/2022_10_22_001259_addresses.php b/database/migrations/2022_10_22_001259_addresses.php new file mode 100644 index 0000000..c8dadd2 --- /dev/null +++ b/database/migrations/2022_10_22_001259_addresses.php @@ -0,0 +1,57 @@ +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'); + } +} diff --git a/database/migrations/2022_10_22_001403_protocols_software.php b/database/migrations/2022_10_22_001403_protocols_software.php new file mode 100644 index 0000000..7f36569 --- /dev/null +++ b/database/migrations/2022_10_22_001403_protocols_software.php @@ -0,0 +1,47 @@ +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'); + } +} diff --git a/database/migrations/2021_08_10_130352_echomail.php b/database/migrations/2022_10_22_001507_echoarea.php similarity index 81% rename from database/migrations/2021_08_10_130352_echomail.php rename to database/migrations/2022_10_22_001507_echoarea.php index 074d960..b15307d 100644 --- a/database/migrations/2021_08_10_130352_echomail.php +++ b/database/migrations/2022_10_22_001507_echoarea.php @@ -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('echoareas'); + Schema::dropIfExists('fileareas'); + Schema::dropIfExists('echoareas'); } } diff --git a/database/migrations/2022_10_22_001607_echomails.php b/database/migrations/2022_10_22_001607_echomails.php new file mode 100644 index 0000000..d23c872 --- /dev/null +++ b/database/migrations/2022_10_22_001607_echomails.php @@ -0,0 +1,92 @@ +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'); + } +} diff --git a/database/migrations/2022_10_22_001723_netmails.php b/database/migrations/2022_10_22_001723_netmails.php new file mode 100644 index 0000000..5a3c6e3 --- /dev/null +++ b/database/migrations/2022_10_22_001723_netmails.php @@ -0,0 +1,88 @@ +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'); + } +} diff --git a/database/migrations/2022_10_22_002411_setup.php b/database/migrations/2022_10_22_002411_setup.php new file mode 100644 index 0000000..22b60d3 --- /dev/null +++ b/database/migrations/2022_10_22_002411_setup.php @@ -0,0 +1,41 @@ +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'); + } +} diff --git a/database/migrations/2021_06_25_040417_create_nodelist.php b/database/migrations/2022_10_22_004225_nodelists.php similarity index 75% rename from database/migrations/2021_06_25_040417_create_nodelist.php rename to database/migrations/2022_10_22_004225_nodelists.php index 5404368..2531d50 100644 --- a/database/migrations/2021_06_25_040417_create_nodelist.php +++ b/database/migrations/2022_10_22_004225_nodelists.php @@ -4,15 +4,15 @@ 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. - * - * @return void - */ - public function up() - { + /** + * Run the migrations. + * + * @return void + */ + public function up() + { Schema::create('nodelists', function (Blueprint $table) { $table->id(); $table->timestamps(); @@ -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) { @@ -33,16 +35,16 @@ class CreateNodelist extends Migration $table->unique(['address_id','nodelist_id']); }); - } + } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { Schema::dropIfExists('address_nodelist'); Schema::dropIfExists('nodelists'); - } + } }