From 5de77e3b354d6580a8faf51b6925cd95e53437b6 Mon Sep 17 00:00:00 2001 From: pro Date: Tue, 27 Jan 2026 20:06:36 +0900 Subject: [PATCH] =?UTF-8?q?feat:=EC=98=81=EC=97=85=EB=8B=B4=EB=8B=B9?= =?UTF-8?q?=EC=9E=90=20User=20=ED=86=B5=ED=95=A9=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - users 테이블에 parent_id, approval_status, approved_by, approved_at, rejection_reason 컬럼 추가 - sales_manager_documents 테이블 생성 (멀티파일 업로드) Co-Authored-By: Claude Opus 4.5 --- ...dd_sales_manager_fields_to_users_table.php | 52 ++++++++++++++++++ ...0_create_sales_manager_documents_table.php | 53 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 database/migrations/2026_01_27_200000_add_sales_manager_fields_to_users_table.php create mode 100644 database/migrations/2026_01_27_200100_create_sales_manager_documents_table.php diff --git a/database/migrations/2026_01_27_200000_add_sales_manager_fields_to_users_table.php b/database/migrations/2026_01_27_200000_add_sales_manager_fields_to_users_table.php new file mode 100644 index 0000000..7a92744 --- /dev/null +++ b/database/migrations/2026_01_27_200000_add_sales_manager_fields_to_users_table.php @@ -0,0 +1,52 @@ +unsignedBigInteger('parent_id')->nullable()->after('is_super_admin'); + $table->foreign('parent_id')->references('id')->on('users')->onDelete('set null'); + + // 승인 상태: pending(대기), approved(승인), rejected(반려) + $table->string('approval_status', 20)->default('approved')->after('parent_id'); + + // 승인 관련 정보 + $table->unsignedBigInteger('approved_by')->nullable()->after('approval_status'); + $table->timestamp('approved_at')->nullable()->after('approved_by'); + $table->text('rejection_reason')->nullable()->after('approved_at'); + + // 인덱스 + $table->index('parent_id'); + $table->index('approval_status'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropForeign(['parent_id']); + $table->dropIndex(['parent_id']); + $table->dropIndex(['approval_status']); + + $table->dropColumn([ + 'parent_id', + 'approval_status', + 'approved_by', + 'approved_at', + 'rejection_reason', + ]); + }); + } +}; diff --git a/database/migrations/2026_01_27_200100_create_sales_manager_documents_table.php b/database/migrations/2026_01_27_200100_create_sales_manager_documents_table.php new file mode 100644 index 0000000..38426ed --- /dev/null +++ b/database/migrations/2026_01_27_200100_create_sales_manager_documents_table.php @@ -0,0 +1,53 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->unsignedBigInteger('user_id'); + + // 파일 정보 + $table->string('file_path', 500); + $table->string('original_name', 255); + $table->string('stored_name', 255); + $table->string('mime_type', 100)->nullable(); + $table->unsignedBigInteger('file_size')->default(0); + + // 문서 타입: id_card(신분증), business_license(사업자등록증), contract(계약서), other(기타) + $table->string('document_type', 50)->default('other'); + $table->string('description', 500)->nullable(); + + // 메타 정보 + $table->unsignedBigInteger('uploaded_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + $table->unsignedBigInteger('deleted_by')->nullable(); + + // 외래키 및 인덱스 + $table->foreign('tenant_id')->references('id')->on('tenants')->onDelete('cascade'); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->foreign('uploaded_by')->references('id')->on('users')->onDelete('set null'); + + $table->index(['tenant_id', 'user_id']); + $table->index('document_type'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sales_manager_documents'); + } +};