mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Show when a device was added and last discovered (#11104)
* Add inserted column to devices table * Added schema for devices.inserted * Show when a device was added and last discovered * Added collection rule for "Device added within the last 60 minutes"
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddInsertedToDevices extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('devices', function (Blueprint $table) {
|
||||
// add inserted column after device id with a default of current_timestamp
|
||||
$table->timestamp('inserted')->default(DB::raw('CURRENT_TIMESTAMP'))->after('device_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('devices', function (Blueprint $table) {
|
||||
// revert add inserted column after device id with a default of current_timestamp
|
||||
$table->dropColumn('inserted');
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user