25 lines
718 B
PHP
25 lines
718 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('metrics', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->timestamp('sampled_at')->index();
|
|
$table->unsignedInteger('mqtt_messages')->default(0); // messages since last sample
|
|
$table->float('cpu_load')->nullable(); // 1-min load average
|
|
$table->unsignedTinyInteger('mem_used_pct')->nullable();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('metrics');
|
|
}
|
|
};
|