id(); $table->unsignedBigInteger('email_template_id'); $table->unsignedBigInteger('member_id'); $table->string('email_address'); $table->enum('status', ['pending', 'sent', 'failed', 'bounced'])->default('pending'); $table->text('error_message')->nullable(); $table->timestamp('sent_at')->nullable(); $table->timestamps(); $table->foreign('email_template_id')->references('id')->on('email_templates')->onDelete('cascade'); $table->foreign('member_id')->references('id')->on('members'); $table->unique(['email_template_id', 'member_id']); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('email_recipients'); } };