- Add AutomationRun::durationInMilliseconds() as the single source of truth for the Invocations list and metrics, replacing the duplicated inline diff. - Fold the variables and root_run_id columns into their create migrations (this branch isn't in production) and drop the standalone alters. - Import Illuminate\Http\Response (aliased) instead of referencing it inline.
42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?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
|
|
{
|
|
Schema::create('automations', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->foreignUuid('workspace_id')->constrained('workspaces')->cascadeOnDelete();
|
|
$table->foreignUuid('user_id')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->string('name');
|
|
$table->string('status')->default('draft');
|
|
$table->string('trigger_type')->nullable();
|
|
$table->json('nodes')->nullable();
|
|
$table->json('connections')->nullable();
|
|
$table->json('variables')->nullable();
|
|
$table->timestamp('activated_at')->nullable();
|
|
$table->timestamp('paused_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['workspace_id', 'status']);
|
|
$table->index(['status', 'trigger_type']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('automations');
|
|
}
|
|
};
|