2025_09_05_110000_create_resource_equipments_table.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. /**
  9. * Run the migrations.
  10. */
  11. public function up(): void
  12. {
  13. Schema::create('resource_equipments', function (Blueprint $table) {
  14. $table->id();
  15. $table->unsignedBigInteger('resource_id')->nullable();
  16. $table->foreign('resource_id')->nullable()->references('id')->on('resources')->onUpdate('cascade')->onDelete('cascade');
  17. $table->unsignedBigInteger('equipment_category_id')->nullable();
  18. $table->foreign('equipment_category_id')->nullable()->references('id')->on('equipment_categories')->onUpdate('cascade')->onDelete('cascade');
  19. $table->string('name')->nullable();
  20. $table->date('start_date')->nullable();
  21. $table->date('end_date')->nullable();
  22. $table->string('supplier')->nullable();
  23. $table->string('sku')->nullable();
  24. $table->text('description')->nullable();
  25. $table->boolean('enabled')->default(1);
  26. $table->softDeletes();
  27. $table->timestamps();
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. */
  33. public function down(): void
  34. {
  35. Schema::dropIfExists('resource_equipments');
  36. }
  37. };