mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
chore(admin): activity logs (#1197)
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
<?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
|
||||
{
|
||||
if (! Schema::hasTable('action_logs')) {
|
||||
Schema::create('action_logs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('batch_id');
|
||||
|
||||
$table->unsignedBigInteger('user_id')->nullable();
|
||||
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
|
||||
|
||||
$table->string('name');
|
||||
$table->morphs('actionable');
|
||||
$table->morphs('target');
|
||||
$table->string('model_type');
|
||||
$table->uuid('model_id')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->json('fields')->nullable();
|
||||
$table->text('exception')->nullable();
|
||||
$table->timestamps(6);
|
||||
$table->timestamp('finished_at', 6)->nullable();
|
||||
|
||||
$table->index(['batch_id', 'model_type', 'model_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('activity_log')) {
|
||||
Schema::create('activity_log', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('log_name')->nullable()->index();
|
||||
$table->text('description');
|
||||
$table->nullableMorphs('subject', 'subject');
|
||||
$table->nullableMorphs('related', 'related');
|
||||
$table->string('event')->nullable();
|
||||
$table->nullableMorphs('causer', 'causer');
|
||||
$table->json('attribute_changes')->nullable();
|
||||
$table->json('properties')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->text('exception')->nullable();
|
||||
$table->timestamps(6);
|
||||
$table->timestamp('finished_at', 6)->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user