add ProcessHistories model and migration for process history tracking

main
Artem-Darius Weber 1 month ago
parent f94f87c386
commit 5a67c1fd72

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProcessHistories extends Model
{
use HasFactory;
protected $fillable = [
'images', 'step_file_name', 'started_at', 'finished_at', 'processed_count', 'stages_timing'
];
protected $casts = [
'images' => 'array',
'stages_timing' => 'array',
'started_at' => 'datetime',
'finished_at' => 'datetime'
];
}

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProcessHistoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('process_histories', function (Blueprint $table) {
$table->id();
$table->json('images'); // [{ "path": "...", "original_name": "..." }, ...]
$table->string('step_file_name')->nullable();
$table->timestamp('started_at')->nullable();
$table->timestamp('finished_at')->nullable();
$table->unsignedInteger('processed_count')->default(0);
$table->json('stages_timing')->nullable(); // {"upload_time":..., "queue_wait_time":..., "processing_time":..., ...}
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('process_histories');
}
}
Loading…
Cancel
Save