Files
go-no-go/database/migrations/2026_02_03_083002_create_logs_table.php

35 lines
953 B
PHP

<?php
declare(strict_types=1);
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('logs', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('session_id')->nullable()->constrained('questionnaire_sessions')->nullOnDelete();
$table->foreignId('category_id')->nullable()->constrained()->nullOnDelete();
$table->string('action', 100);
$table->json('metadata')->nullable();
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('logs');
}
};