v0.9.0: no-MAC device tracking, IP-change dashboard, extended search
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('network_segments', function (Blueprint $table) {
|
||||
// Scan-Zyklus in Minuten: null = manuell, 5/15/30/60/360/1440
|
||||
$table->unsignedInteger('scan_interval_minutes')->nullable()->after('active');
|
||||
// Zeitpunkt des letzten automatischen Scans
|
||||
$table->timestamp('last_scanned_at')->nullable()->after('scan_interval_minutes');
|
||||
// Optionale nmap-Parameter, z.B. "-sn" oder "-sn -p 22,80,443"
|
||||
$table->string('nmap_options')->default('-sn')->after('last_scanned_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('network_segments', function (Blueprint $table) {
|
||||
$table->dropColumn(['scan_interval_minutes', 'last_scanned_at', 'nmap_options']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('network_ip_notes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('segment_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->index();
|
||||
$table->text('note')->nullable();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['segment_id', 'ip_address']);
|
||||
$table->foreign('segment_id')->references('id')->on('network_segments')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('network_ip_notes');
|
||||
}
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// MAC-Adresse nullable machen, damit nmap-Hosts ohne MAC als Gerät erfasst werden können.
|
||||
// In MySQL/MariaDB erlaubt UNIQUE NULL mehrere NULL-Werte gleichzeitig.
|
||||
DB::statement('ALTER TABLE network_devices MODIFY mac_address VARCHAR(255) NULL');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// NULL-Einträge entfernen, bevor wir NOT NULL setzen
|
||||
DB::statement("DELETE FROM network_devices WHERE mac_address IS NULL");
|
||||
DB::statement('ALTER TABLE network_devices MODIFY mac_address VARCHAR(255) NOT NULL');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user