Add video engagement tracking and heatmap

This commit is contained in:
2026-07-19 20:13:55 +02:00
parent 4f81164b44
commit a5bf2ac245
9 changed files with 491 additions and 0 deletions
@@ -0,0 +1,33 @@
<?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::create('video_engagement', function (Blueprint $table) {
$table->id();
$table->foreignId('episode_id')->constrained('episodes')->cascadeOnDelete();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->unsignedSmallInteger('segment');
$table->timestamps();
// One row per user per episode per segment — no duplicates
$table->unique(['episode_id', 'user_id', 'segment']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('video_engagement');
}
};