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:
Joseph Tingiris
2020-02-05 15:06:43 -05:00
committed by GitHub
parent ac84eea243
commit 79bdbe91b5
4 changed files with 55 additions and 7 deletions

View File

@@ -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');
});
}
}