feat(notification): implement idempotent email delivery system and update related services
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?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('email_deliveries', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('idempotency_key')->unique();
|
||||
$table->string('email_type')->index();
|
||||
$table->string('tenant_code')->nullable()->index();
|
||||
$table->string('status')->index();
|
||||
$table->unsignedInteger('attempts')->default(0);
|
||||
$table->json('context')->nullable();
|
||||
$table->string('recipient_fingerprint', 64)->nullable();
|
||||
$table->uuid('claim_token')->nullable()->index();
|
||||
$table->timestamp('claimed_at')->nullable();
|
||||
$table->timestamp('lease_expires_at')->nullable()->index();
|
||||
$table->timestamp('sent_at')->nullable();
|
||||
$table->timestamp('failed_at')->nullable();
|
||||
$table->text('last_error')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('email_deliveries');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('event_date_notification_deliveries', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('notification_key')->unique();
|
||||
$table->string('notification_type');
|
||||
$table->string('tenant_code');
|
||||
$table->unsignedBigInteger('event_date_id');
|
||||
$table->unsignedBigInteger('destination_event_date_id')->nullable();
|
||||
$table->unsignedBigInteger('purchase_id');
|
||||
$table->timestamp('sent_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('event_date_notification_deliveries');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user