mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix Port Channel (#16227)
* Fix expandable sizing * Temp fix: port_id_{low,high} is actually ifIndex * new PortsStack discovery module, store actual port_ids * Show 4 rows of ports by default * Add test data * Fix up the single port view too * Apply fixes from StyleCI * Update db_schema.yaml * Update base migration because sqlite cannot add primary keys * Fix phpstan failures --------- Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
This commit is contained in:
@@ -13,11 +13,14 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ports_stack', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('device_id');
|
||||
$table->unsignedInteger('port_id_high');
|
||||
$table->unsignedInteger('port_id_low');
|
||||
$table->unsignedInteger('high_ifIndex');
|
||||
$table->unsignedBigInteger('high_port_id')->nullable();
|
||||
$table->unsignedInteger('low_ifIndex');
|
||||
$table->unsignedBigInteger('low_port_id')->nullable();
|
||||
$table->string('ifStackStatus', 32);
|
||||
$table->unique(['device_id', 'port_id_high', 'port_id_low']);
|
||||
$table->unique(['device_id', 'high_ifIndex', 'low_ifIndex']);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasColumn('ports_stack', 'id')) {
|
||||
Schema::table('ports_stack', function (Blueprint $table) {
|
||||
$table->id()->first();
|
||||
$table->unsignedBigInteger('high_port_id')->nullable()->after('port_id_high');
|
||||
$table->unsignedBigInteger('low_port_id')->nullable()->after('port_id_low');
|
||||
$table->renameColumn('port_id_high', 'high_ifIndex');
|
||||
$table->renameColumn('port_id_low', 'low_ifIndex');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('ports_stack', function (Blueprint $table) {
|
||||
$table->renameColumn('high_ifIndex', 'port_id_high');
|
||||
$table->renameColumn('low_ifIndex', 'port_id_low');
|
||||
$table->dropColumn(['id', 'high_port_id', 'low_port_id']);
|
||||
});
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user