openstamanager/database/migrations/2023_02_23_174814_create_ac...

50 lines
1.5 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class() extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('action_logs', function (Blueprint $table) {
$table->id();
$table->char('batch_id', 36);
$table->unsignedBigInteger('user_id')->index()->nullable();
$table->string('name');
$table->string('actionable_type');
$table->unsignedBigInteger('actionable_id');
$table->string('target_type')->nullable();
$table->unsignedBigInteger('target_id')->nullable();
$table->string('model_type')->nullable();
$table->unsignedBigInteger('model_id')->nullable();
$table->text('fields')->nullable();
$table->string('status', 25)->default('running');
$table->text('original')->nullable();
$table->text('changes')->nullable();
$table->text('exception')->nullable();
$table->json('meta')->nullable();
$table->timestamps();
$table->index(['actionable_type', 'actionable_id']);
$table->index(['batch_id', 'model_type', 'model_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('action_logs');
}
};