Skip to content

Commit

Permalink
Rename tables ynh_{disk|memory}_usage to ynh_osquery_{disk|memory}_us…
Browse files Browse the repository at this point in the history
…age.
  • Loading branch information
csavelief committed Aug 11, 2024
1 parent ae8f68f commit e5f83cd
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/Jobs/AgeOffOsqueryEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private function historizeDiskUsage(): void
->update(['packed' => false]);

DB::unprepared("
INSERT INTO ynh_disk_usage (
INSERT INTO ynh_osquery_disk_usage (
ynh_server_id,
timestamp,
percent_available,
Expand Down Expand Up @@ -76,7 +76,7 @@ private function historizeMemoryUsage(): void
->update(['packed' => false]);

DB::unprepared("
INSERT INTO ynh_memory_usage (
INSERT INTO ynh_osquery_memory_usage (
ynh_server_id,
timestamp,
percent_available,
Expand Down
4 changes: 2 additions & 2 deletions app/Models/YnhOsquery.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function memoryUsage(Collection $servers, int $limit = 1000): Coll
space_left_gb,
total_space_gb,
used_space_gb
FROM ynh_memory_usage
FROM ynh_osquery_memory_usage
ORDER BY timestamp DESC
LIMIT {$limit}
Expand Down Expand Up @@ -107,7 +107,7 @@ public static function diskUsage(Collection $servers, int $limit = 1000): Collec
space_left_gb,
total_space_gb,
used_space_gb
FROM ynh_disk_usage
FROM ynh_osquery_disk_usage
ORDER BY timestamp DESC
LIMIT {$limit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class YnhDiskUsage extends Model
class YnhOsqueryDiskUsage extends Model
{
use HasFactory;

protected $table = 'ynh_disk_usage';
protected $table = 'ynh_osquery_disk_usage';

protected $fillable = [
'ynh_server_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class YnhMemoryUsage extends Model
class YnhOsqueryMemoryUsage extends Model
{
use HasFactory;

protected $table = 'ynh_memory_usage';
protected $table = 'ynh_osquery_memory_usage';

protected $fillable = [
'ynh_server_id',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::rename('ynh_disk_usage', 'ynh_osquery_disk_usage');
Schema::rename('ynh_memory_usage', 'ynh_osquery_memory_usage');
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::rename('ynh_osquery_disk_usage', 'ynh_disk_usage');
Schema::rename('ynh_osquery_memory_usage', 'ynh_memory_usage');
}
};

0 comments on commit e5f83cd

Please sign in to comment.