0001_01_01_000002_create_jobs_table.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('jobs', function (Blueprint $table) {
  13. $table->id();
  14. $table->string('queue')->index();
  15. $table->longText('payload');
  16. $table->unsignedTinyInteger('attempts');
  17. $table->unsignedInteger('reserved_at')->nullable();
  18. $table->unsignedInteger('available_at');
  19. $table->unsignedInteger('created_at');
  20. });
  21. Schema::create('job_batches', function (Blueprint $table) {
  22. $table->string('id')->primary();
  23. $table->string('name');
  24. $table->integer('total_jobs');
  25. $table->integer('pending_jobs');
  26. $table->integer('failed_jobs');
  27. $table->longText('failed_job_ids');
  28. $table->mediumText('options')->nullable();
  29. $table->integer('cancelled_at')->nullable();
  30. $table->integer('created_at');
  31. $table->integer('finished_at')->nullable();
  32. });
  33. Schema::create('failed_jobs', function (Blueprint $table) {
  34. $table->id();
  35. $table->string('uuid')->unique();
  36. $table->text('connection');
  37. $table->text('queue');
  38. $table->longText('payload');
  39. $table->longText('exception');
  40. $table->timestamp('failed_at')->useCurrent();
  41. });
  42. }
  43. /**
  44. * Reverse the migrations.
  45. */
  46. public function down(): void
  47. {
  48. Schema::dropIfExists('jobs');
  49. Schema::dropIfExists('job_batches');
  50. Schema::dropIfExists('failed_jobs');
  51. }
  52. };