Files
hr/database/migrations/2026_07_30_112805_create_employees_table.php
2026-07-30 17:24:40 +05:00

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');
}
};