45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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('employees', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->string('employee_number')->unique();
|
|
$table->string('full_name');
|
|
$table->string('national_id')->nullable();
|
|
$table->string('gender');
|
|
$table->date('birth_date');
|
|
$table->string('phone');
|
|
$table->text('address')->nullable();
|
|
$table->foreignId('department_id')->constrained()->restrictOnDelete();
|
|
$table->foreignId('position_id')->constrained()->restrictOnDelete();
|
|
$table->foreignId('shift_id')->constrained()->restrictOnDelete();
|
|
$table->string('employment_status')->default('active');
|
|
$table->date('hire_date');
|
|
$table->date('termination_date')->nullable();
|
|
$table->text('notes')->nullable();
|
|
$table->string('profile_photo_path')->nullable();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->index('full_name');
|
|
$table->index('phone');
|
|
$table->index('employment_status');
|
|
$table->index(['department_id', 'employment_status']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('employees');
|
|
}
|
|
};
|