diff --git a/database/migrations/2026_03_12_120000_create_pmis_workers_table.php b/database/migrations/2026_03_12_120000_create_pmis_workers_table.php new file mode 100644 index 0000000..ffda5f3 --- /dev/null +++ b/database/migrations/2026_03_12_120000_create_pmis_workers_table.php @@ -0,0 +1,38 @@ +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'); + } +};