feat: [pmis] pmis_workers 테이블 마이그레이션 추가

- 건설PMIS 현장 작업자 전용 프로필 테이블
- tenant_id + user_id 유니크 제약 포함
This commit is contained in:
김보곤
2026-03-12 12:22:58 +09:00
parent 7eab19508a
commit c4b4be495a

View File

@@ -0,0 +1,38 @@
<?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('pmis_workers', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->default(1)->index();
$table->unsignedBigInteger('user_id')->nullable()->index()->comment('SAM users 테이블 FK (연결된 계정)');
$table->string('name', 50);
$table->string('login_id', 50)->nullable()->comment('PMIS 로그인 아이디');
$table->string('phone', 20)->nullable();
$table->string('email', 255)->nullable();
$table->string('department', 100)->nullable()->comment('소속 부서/현장소장 등');
$table->string('position', 50)->nullable()->comment('직책');
$table->string('role_type', 50)->nullable()->comment('권한 유형: 협력업체사용자, 원청관리자 등');
$table->string('gender', 5)->nullable();
$table->string('company', 100)->nullable()->comment('소속 업체명');
$table->string('profile_photo_path', 500)->nullable();
$table->json('options')->nullable();
$table->timestamp('last_login_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unique(['tenant_id', 'user_id'], 'pmis_workers_tenant_user_unique');
});
}
public function down(): void
{
Schema::dropIfExists('pmis_workers');
}
};