feat: Implement value change logging functionality with models, traits, and migration; add tests for logging behavior and value change mapping
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?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('value_changes', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->morphs('trackable');
|
||||
$table->string('attribute');
|
||||
$table->text('old_value')->nullable();
|
||||
$table->text('new_value')->nullable();
|
||||
$table->timestamp('changed_at');
|
||||
$table->string('actor_type');
|
||||
$table->foreignId('user_id')
|
||||
->nullable()
|
||||
->constrained('users')
|
||||
->cascadeOnUpdate()
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('value_changes');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user