move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
@@ -0,0 +1,67 @@
<?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('automations', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->string('trigger_type')->index();
$table->json('trigger_config')->nullable();
$table->string('status', 20)->default('draft')->index();
$table->boolean('stop_on_failure')->default(true);
$table->unsignedInteger('run_count')->default(0);
$table->timestamp('last_ran_at')->nullable();
$table->timestamp('next_run_at')->nullable()->index();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
});
Schema::create('automation_steps', function (Blueprint $table) {
$table->id();
$table->foreignId('automation_id')->constrained('automations')->cascadeOnDelete();
$table->unsignedSmallInteger('position')->default(1);
$table->string('action_type');
$table->string('name')->nullable();
$table->json('configuration')->nullable();
$table->boolean('is_enabled')->default(true);
$table->timestamps();
$table->unique(['automation_id', 'position']);
});
Schema::create('automation_runs', function (Blueprint $table) {
$table->id();
$table->foreignId('automation_id')->constrained('automations')->cascadeOnDelete();
$table->uuid('execution_id')->unique();
$table->string('trigger_type');
$table->json('payload')->nullable();
$table->string('status', 20)->default('queued')->index();
$table->unsignedSmallInteger('current_step')->default(0);
$table->text('error')->nullable();
$table->timestamp('started_at')->nullable();
$table->timestamp('finished_at')->nullable();
$table->timestamps();
});
Schema::create('automation_run_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('automation_run_id')->constrained('automation_runs')->cascadeOnDelete();
$table->foreignId('automation_step_id')->nullable()->constrained('automation_steps')->nullOnDelete();
$table->string('level', 20)->default('info');
$table->string('message');
$table->json('context')->nullable();
$table->timestamp('created_at')->useCurrent();
});
}
public function down(): void
{
Schema::dropIfExists('automation_run_logs');
Schema::dropIfExists('automation_runs');
Schema::dropIfExists('automation_steps');
Schema::dropIfExists('automations');
}
};