2025_07_11_090201_create_mail_scheduled_table.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. use App\Database\Migrations\TenantMigration;
  6. return new class extends TenantMigration
  7. {
  8. public function up()
  9. {
  10. Schema::create('email_scheduled', function (Blueprint $table) {
  11. $table->id();
  12. $table->unsignedBigInteger('template_id')->nullable();
  13. $table->string('subject');
  14. $table->longText('content');
  15. $table->timestamp('scheduled_at');
  16. $table->enum('status', ['scheduled', 'sending', 'sent', 'failed'])->default('scheduled');
  17. $table->unsignedBigInteger('created_by');
  18. $table->json('delivery_report')->nullable();
  19. $table->timestamps();
  20. $table->foreign('template_id')->references('id')->on('email_templates')->onDelete('set null');
  21. $table->foreign('created_by')->references('id')->on('users');
  22. });
  23. }
  24. public function down()
  25. {
  26. Schema::dropIfExists('email_scheduled');
  27. }
  28. };