0001_01_01_000002_create_jobs_table.php 1.8 KB

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