2025_09_26_103100_create_project_budgets_table.php 1.6 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('project_budgets', 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->float('hours')->nullable();
  18. $table->unsignedBigInteger('company_activity_id')->nullable();
  19. $table->foreign('company_activity_id')->nullable()->references('id')->on('company_activities')->onUpdate('cascade')->onDelete('cascade');
  20. $table->unsignedBigInteger('company_rate_id')->nullable();
  21. $table->foreign('company_rate_id')->nullable()->references('id')->on('company_rates')->onUpdate('cascade')->onDelete('cascade');
  22. $table->decimal('cost', total: 8, places: 2);
  23. $table->decimal('revenue', total: 8, places: 2);
  24. $table->decimal('margin', total: 8, places: 2);
  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('project_budgets');
  36. }
  37. };