Add notification action foundation
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user