feat: Netzwerk-Modul v0.5.0 – Import, Geräte-Tracking, Ereignislog
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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_scans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('subnet'); // z.B. 192.168.86.0/24
|
||||
$table->string('source')->default('manual'); // manual | import | auto
|
||||
$table->string('scanner')->nullable(); // z.B. "Angry IP Scanner 3.9.3"
|
||||
$table->integer('total_hosts')->default(0);
|
||||
$table->integer('online_hosts')->default(0);
|
||||
$table->integer('new_devices')->default(0);
|
||||
$table->integer('changed_devices')->default(0);
|
||||
$table->text('notes')->nullable();
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('network_scans');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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_devices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('mac_address')->unique(); // Primärschlüssel-Logik
|
||||
$table->string('current_ip')->nullable();
|
||||
$table->string('hostname')->nullable();
|
||||
$table->string('mac_vendor')->nullable(); // Hersteller
|
||||
$table->string('status')->default('unknown'); // online | offline | unknown
|
||||
$table->string('netbios_name')->nullable();
|
||||
$table->integer('ttl')->nullable();
|
||||
$table->text('ports')->nullable();
|
||||
$table->text('notes')->nullable(); // manuelle Notizen
|
||||
$table->string('label')->nullable(); // Benutzerfreundlicher Name
|
||||
$table->timestamp('first_seen_at')->nullable();
|
||||
$table->timestamp('last_seen_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('network_devices');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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_hosts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('scan_id')->constrained('network_scans')->cascadeOnDelete();
|
||||
$table->foreignId('device_id')->nullable()->constrained('network_devices')->nullOnDelete();
|
||||
$table->string('ip_address');
|
||||
$table->string('mac_address')->nullable();
|
||||
$table->string('hostname')->nullable();
|
||||
$table->string('mac_vendor')->nullable();
|
||||
$table->string('status')->default('offline'); // online | offline | filtered
|
||||
$table->integer('ping_ms')->nullable();
|
||||
$table->string('netbios_info')->nullable();
|
||||
$table->integer('ttl')->nullable();
|
||||
$table->text('ports')->nullable();
|
||||
$table->text('http_sender')->nullable();
|
||||
$table->text('web_detection')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['scan_id', 'ip_address']);
|
||||
$table->index('mac_address');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('network_hosts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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_device_events', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('device_id')->constrained('network_devices')->cascadeOnDelete();
|
||||
$table->foreignId('scan_id')->nullable()->constrained('network_scans')->nullOnDelete();
|
||||
$table->string('event_type'); // new_device | ip_changed | came_online | went_offline | manual_note | label_changed
|
||||
$table->string('old_value')->nullable();
|
||||
$table->string('new_value')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('documented')->default(false); // manuell bestätigt
|
||||
$table->foreignId('documented_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('documented_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['device_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('network_device_events');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user