37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('projects', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
|
|
$table->string('name');
|
|
$table->string('code', 20);
|
|
$table->text('description')->nullable();
|
|
$table->enum('status', ['planning', 'in_progress', 'on_hold', 'completed', 'cancelled'])->default('planning');
|
|
$table->date('start_date');
|
|
$table->date('end_date');
|
|
$table->tinyInteger('progress')->default(0);
|
|
$table->decimal('budget', 15, 0)->default(0);
|
|
$table->foreignId('default_currency_id')->nullable()->constrained('currencies')->nullOnDelete();
|
|
$table->decimal('budget_usd', 15, 2)->default(0);
|
|
$table->foreignId('manager_id')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
$table->index(['tenant_id', 'code']);
|
|
$table->index('status');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('projects');
|
|
}
|
|
};
|