2025_09_26_103000_create_projects_table.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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('projects', function (Blueprint $table) {
  14. $table->id();
  15. $table->string('name')->nullable();
  16. $table->string('code')->nullable();
  17. $table->unsignedBigInteger('customer_id')->nullable();
  18. $table->foreign('customer_id')->nullable()->references('id')->on('customers')->onUpdate('cascade')->onDelete('cascade');
  19. $table->unsignedBigInteger('company_service_id')->nullable();
  20. $table->foreign('company_service_id')->nullable()->references('id')->on('company_services')->onUpdate('cascade')->onDelete('cascade');
  21. $table->text('description')->nullable();
  22. $table->date('start_date')->nullable();
  23. $table->date('end_date')->nullable();
  24. $table->unsignedBigInteger('project_manager_id')->nullable();
  25. //$table->foreign('customer_id')->nullable()->references('id')->on('customers')->onUpdate('cascade')->onDelete('cascade');
  26. $table->decimal('project_value', total: 8, places: 2);
  27. $table->float('hours')->nullable();
  28. $table->integer('status')->nullable();
  29. $table->boolean('billable')->default(1);
  30. $table->boolean('enabled')->default(1);
  31. $table->softDeletes();
  32. $table->timestamps();
  33. });
  34. }
  35. /**
  36. * Reverse the migrations.
  37. */
  38. public function down(): void
  39. {
  40. Schema::dropIfExists('projects');
  41. }
  42. };