2025_07_11_090201_create_sms_scheduled_table.php 967 B

1234567891011121314151617181920212223242526272829
  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('sms_scheduled', function (Blueprint $table) {
  11. $table->id();
  12. $table->unsignedBigInteger('template_id')->nullable();
  13. $table->text('content');
  14. $table->timestamp('scheduled_at');
  15. $table->enum('status', ['scheduled', 'sent', 'failed'])->default('scheduled');
  16. $table->unsignedBigInteger('created_by');
  17. $table->timestamps();
  18. $table->foreign('template_id')->references('id')->on('sms_templates')->onDelete('set null');
  19. $table->foreign('created_by')->references('id')->on('users');
  20. });
  21. }
  22. public function down()
  23. {
  24. Schema::dropIfExists('sms_scheduled');
  25. }
  26. };