2025_09_05_110000_create_resource_contracts_table.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_contracts', 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('contract_type_id')->nullable();
  18. $table->foreign('contract_type_id')->nullable()->references('id')->on('contract_types')->onUpdate('cascade')->onDelete('cascade');
  19. $table->date('contract_date')->nullable();
  20. $table->string('contract_number')->nullable();
  21. $table->string('position')->nullable();
  22. $table->string('role')->nullable();
  23. $table->date('start_date')->nullable();
  24. $table->date('end_date')->nullable();
  25. $table->text('notes')->nullable();
  26. $table->boolean('enabled')->default(1);
  27. $table->softDeletes();
  28. $table->timestamps();
  29. });
  30. }
  31. /**
  32. * Reverse the migrations.
  33. */
  34. public function down(): void
  35. {
  36. Schema::dropIfExists('resource_contracts');
  37. }
  38. };