feat: implement Learning Tracer (heartbeat duration tracking) for LPK Audit

This commit is contained in:
2026-01-23 19:06:32 +07:00
parent 8a61cda3e4
commit 6caa0e88dd
5 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('user_progress', function (Blueprint $table) {
$table->timestamp('started_at')->nullable()->after('lesson_id');
$table->unsignedInteger('time_spent_seconds')->default(0)->after('completed_at');
$table->timestamp('last_heartbeat_at')->nullable()->after('time_spent_seconds');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('user_progress', function (Blueprint $table) {
$table->dropColumn(['started_at', 'time_spent_seconds', 'last_heartbeat_at']);
});
}
};