Add notification action foundation

This commit is contained in:
Eric Peters
2026-04-20 21:59:57 +02:00
parent 8df9622f1b
commit e4762f8e32
22 changed files with 1047 additions and 0 deletions
@@ -0,0 +1,38 @@
<?php
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('notification_actions', function (Blueprint $table) {
$table->id();
$table->foreignId('project_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->boolean('enabled')->default(true);
$table->string('event_type');
$table->string('channel');
$table->json('channel_configuration');
$table->text('message_template')->nullable();
$table->text('delivery_url');
$table->timestamps();
$table->index(['project_id', 'event_type', 'enabled']);
$table->index(['project_id', 'channel']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('notification_actions');
}
};
@@ -0,0 +1,41 @@
<?php
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('notification_delivery_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('notification_action_id')->constrained()->cascadeOnDelete();
$table->string('event_type');
$table->string('channel');
$table->string('delivery_status');
$table->unsignedInteger('attempt_count')->default(0);
$table->unsignedSmallInteger('http_status')->nullable();
$table->text('response_excerpt')->nullable();
$table->text('error_excerpt')->nullable();
$table->json('payload_metadata')->nullable();
$table->timestamp('last_attempted_at')->nullable();
$table->timestamp('delivered_at')->nullable();
$table->timestamps();
$table->index(['notification_action_id', 'delivery_status']);
$table->index(['notification_action_id', 'created_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('notification_delivery_logs');
}
};