35 lines
1.2 KiB
PHP
35 lines
1.2 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('contracts', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('unit_id')->constrained('units')->onDelete('cascade');
|
|
$table->unsignedBigInteger('person_id');
|
|
$table->string('contract_type');
|
|
$table->string('contract_number')->unique();
|
|
$table->string('ejari_no');
|
|
$table->date('start_date');
|
|
$table->date('end_date');
|
|
$table->integer('duration_months');
|
|
$table->decimal('total_amount', 15, 2);
|
|
$table->string('status')->default('active');
|
|
$table->text('notes')->nullable();
|
|
$table->timestamps();
|
|
$table->foreignId('created_by')->nullable()->constrained('users');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users');
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('contracts');
|
|
}
|
|
};
|