2025_11_11_212131_create_batchables_table.php 758 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. use App\Models\JobBatch;
  3. use Illuminate\Database\Migrations\Migration;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Support\Facades\Schema;
  6. return new class extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. */
  11. public function up(): void
  12. {
  13. Schema::create('batchables', function (Blueprint $table) {
  14. $table->id();
  15. $table->foreignUlid('batch_id', 36)->constrained((new JobBatch)->getTable())->cascadeOnUpdate()->cascadeOnDelete();
  16. $table->nullableUuidMorphs('batchable');
  17. $table->string('type')->nullable();
  18. });
  19. }
  20. /**
  21. * Reverse the migrations.
  22. */
  23. public function down(): void
  24. {
  25. Schema::dropIfExists('batchables');
  26. }
  27. };