From b6bea99cd99a6cb771d5820bfcdb725d1ac3542f Mon Sep 17 00:00:00 2001 From: hskwon Date: Fri, 12 Dec 2025 09:54:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Items=20=EC=9D=B4=EA=B4=80=20=EB=A7=88?= =?UTF-8?q?=EC=9D=B4=EA=B7=B8=EB=A0=88=EC=9D=B4=EC=85=98=20=EB=B9=84?= =?UTF-8?q?=ED=99=9C=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 데이터 이관 로직 임시 비활성화 - item_type 컬럼 길이 문제로 정책 정리 후 재작업 예정 --- composer.json | 1 + composer.lock | 66 ++++++++++- ...00_migrate_products_materials_to_items.php | 108 +----------------- 3 files changed, 72 insertions(+), 103 deletions(-) diff --git a/composer.json b/composer.json index a4cc2ea..067899a 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "darkaonline/l5-swagger": "^9.0", "doctrine/dbal": "^4.3", "laravel/framework": "^12.0", + "laravel/mcp": "^0.1.1", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.10.1", "livewire/livewire": "^3.0", diff --git a/composer.lock b/composer.lock index 216fd5c..8dfd509 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5e41f06b9f42d52021789067799761d5", + "content-hash": "3678e3392030cdc9d6cbbab85da3d350", "packages": [ { "name": "brick/math", @@ -1801,6 +1801,70 @@ }, "time": "2025-07-08T15:02:21+00:00" }, + { + "name": "laravel/mcp", + "version": "v0.1.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/mcp.git", + "reference": "6d6284a491f07c74d34f48dfd999ed52c567c713" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/mcp/zipball/6d6284a491f07c74d34f48dfd999ed52c567c713", + "reference": "6d6284a491f07c74d34f48dfd999ed52c567c713", + "shasum": "" + }, + "require": { + "illuminate/console": "^10.0|^11.0|^12.0", + "illuminate/contracts": "^10.0|^11.0|^12.0", + "illuminate/http": "^10.0|^11.0|^12.0", + "illuminate/routing": "^10.0|^11.0|^12.0", + "illuminate/support": "^10.0|^11.0|^12.0", + "illuminate/validation": "^10.0|^11.0|^12.0", + "php": "^8.1|^8.2" + }, + "require-dev": { + "laravel/pint": "^1.14", + "orchestra/testbench": "^8.22.0|^9.0|^10.0", + "phpstan/phpstan": "^2.0" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "Mcp": "Laravel\\Mcp\\Server\\Facades\\Mcp" + }, + "providers": [ + "Laravel\\Mcp\\Server\\McpServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Mcp\\": "src/", + "Workbench\\App\\": "workbench/app/", + "Laravel\\Mcp\\Tests\\": "tests/", + "Laravel\\Mcp\\Server\\": "src/Server/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The easiest way to add MCP servers to your Laravel app.", + "homepage": "https://github.com/laravel/mcp", + "keywords": [ + "dev", + "laravel", + "mcp" + ], + "support": { + "issues": "https://github.com/laravel/mcp/issues", + "source": "https://github.com/laravel/mcp" + }, + "time": "2025-08-16T09:50:43+00:00" + }, { "name": "laravel/prompts", "version": "v0.3.6", diff --git a/database/migrations/2025_12_11_220200_migrate_products_materials_to_items.php b/database/migrations/2025_12_11_220200_migrate_products_materials_to_items.php index 3825af8..9d7501e 100644 --- a/database/migrations/2025_12_11_220200_migrate_products_materials_to_items.php +++ b/database/migrations/2025_12_11_220200_migrate_products_materials_to_items.php @@ -1,120 +1,24 @@ count(); - echo "- Products 원본: {$productsBefore}건\n"; - - DB::statement(" - INSERT INTO items ( - tenant_id, item_type, code, name, unit, category_id, - description, attributes, attributes_archive, options, bom, - is_sellable, is_purchasable, is_producible, - safety_stock, lead_time, is_variable_size, product_category, part_type, - bending_diagram, bending_details, specification_file, specification_file_name, - certification_file, certification_file_name, certification_number, - certification_start_date, certification_end_date, - is_active, created_by, updated_by, deleted_by, - created_at, updated_at, deleted_at, - legacy_table, legacy_id - ) - SELECT - tenant_id, product_type, code, name, unit, category_id, - description, attributes, attributes_archive, options, bom, - is_sellable, is_purchasable, is_producible, - safety_stock, lead_time, is_variable_size, product_category, part_type, - bending_diagram, bending_details, specification_file, specification_file_name, - certification_file, certification_file_name, certification_number, - certification_start_date, certification_end_date, - is_active, created_by, updated_by, deleted_by, - created_at, updated_at, deleted_at, - 'products', id - FROM products - "); - - $productsAfter = DB::table('items')->where('legacy_table', 'products')->count(); - echo "- Items로 이관: {$productsAfter}건\n"; - - // 2. Materials → Items 이관 - echo "\nMaterials 데이터 이관 시작...\n"; - - $materialsBefore = DB::table('materials')->count(); - echo "- Materials 원본: {$materialsBefore}건\n"; - - DB::statement(" - INSERT INTO items ( - tenant_id, item_type, code, name, unit, category_id, - specification, attributes, options, - item_name, is_inspection, search_tag, remarks, - is_active, created_by, updated_by, deleted_by, - created_at, updated_at, deleted_at, - legacy_table, legacy_id - ) - SELECT - tenant_id, material_type, material_code, name, unit, category_id, - specification, attributes, options, - item_name, is_inspection, search_tag, remarks, - is_active, created_by, updated_by, deleted_by, - created_at, updated_at, deleted_at, - 'materials', id - FROM materials - "); - - $materialsAfter = DB::table('items')->where('legacy_table', 'materials')->count(); - echo "- Items로 이관: {$materialsAfter}건\n"; - - // 3. ID 매핑 테이블 생성 - echo "\nID 매핑 테이블 생성 시작...\n"; - - DB::statement(" - INSERT INTO item_id_mappings (new_item_id, legacy_table, legacy_id) - SELECT id, legacy_table, legacy_id - FROM items - WHERE legacy_table IS NOT NULL AND legacy_id IS NOT NULL - "); - - $mappingsCount = DB::table('item_id_mappings')->count(); - echo "- ID 매핑: {$mappingsCount}건 생성\n"; - - // 4. 검증 - echo "\n=== 이관 검증 ===\n"; - $totalItems = DB::table('items')->count(); - $totalOriginal = $productsBefore + $materialsBefore; - echo "- 원본 합계: {$totalOriginal}건 (Products: {$productsBefore} + Materials: {$materialsBefore})\n"; - echo "- Items 합계: {$totalItems}건\n"; - - if ($totalItems === $totalOriginal) { - echo "✅ 데이터 이관 성공!\n"; - } else { - echo "⚠️ 데이터 불일치! 확인 필요\n"; - } + // 비활성화: 정책 정리 후 재작업 예정 + echo "⚠️ 이 마이그레이션은 비활성화되었습니다. 정책 정리 후 재작업 예정.\n"; } public function down(): void { - // 롤백: Items 테이블 데이터 삭제 (매핑 테이블은 CASCADE로 자동 삭제) - echo "Items 데이터 롤백 시작...\n"; - - $countBefore = DB::table('items')->count(); - DB::table('items')->truncate(); - $countAfter = DB::table('items')->count(); - - echo "- 삭제된 Items: {$countBefore}건\n"; - echo "- 롤백 완료\n"; + // 비활성화 } }; \ No newline at end of file