fix: Items 이관 마이그레이션 비활성화
- 데이터 이관 로직 임시 비활성화 - item_type 컬럼 길이 문제로 정책 정리 후 재작업 예정
This commit is contained in:
@@ -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",
|
||||
|
||||
66
composer.lock
generated
66
composer.lock
generated
@@ -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",
|
||||
|
||||
@@ -1,120 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Products/Materials 데이터를 Items 테이블로 이관
|
||||
*
|
||||
* 1. Products 테이블 데이터 → Items 이관
|
||||
* 2. Materials 테이블 데이터 → Items 이관
|
||||
* 3. ID 매핑 테이블 생성
|
||||
* ⚠️ 이 마이그레이션은 비활성화됨
|
||||
* - items 테이블 정책 정리 후 재작업 예정
|
||||
* - 2025_12_12_100000_rollback_items_migration.php 참조
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// 1. Products → Items 이관
|
||||
echo "Products 데이터 이관 시작...\n";
|
||||
|
||||
$productsBefore = DB::table('products')->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";
|
||||
// 비활성화
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user