mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add application metrics model and relationships (#15417)
* Add application metrics model and relationships * update schema check file * Add missed index * Update testing definition * sqlite can't create the id later * update schema dumps * update testing_persistent schema * update baseline
This commit is contained in:
@@ -49,4 +49,11 @@ class Application extends DeviceRelatedModel
|
||||
{
|
||||
return $this->displayName();
|
||||
}
|
||||
|
||||
// ---- Define Relationships ----
|
||||
|
||||
public function metrics()
|
||||
{
|
||||
return $this->hasMany(ApplicationMetric::class, 'app_id', 'app_id');
|
||||
}
|
||||
}
|
||||
|
20
app/Models/ApplicationMetric.php
Normal file
20
app/Models/ApplicationMetric.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ApplicationMetric extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
// ---- Define Relationships ----
|
||||
|
||||
public function app()
|
||||
{
|
||||
return $this->belongsTo(Application::class, 'app_id');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user