2025_09_05_110000_create_resource_documents_table.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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_documents', 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->string('document_type')->nullable();
  18. $table->string('name')->nullable();
  19. $table->text('description')->nullable();
  20. $table->string('file')->nullable();
  21. $table->boolean('enabled')->default(1);
  22. $table->softDeletes();
  23. $table->timestamps();
  24. });
  25. }
  26. /**
  27. * Reverse the migrations.
  28. */
  29. public function down(): void
  30. {
  31. Schema::dropIfExists('resource_documents');
  32. }
  33. };