fix: Items 이관 롤백 마이그레이션 추가

- items, item_id_mappings 테이블 삭제
- 정책 정리 후 재작업 예정
This commit is contained in:
2025-12-12 09:45:37 +09:00
parent a636311168
commit 33260d5333

View File

@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Items 테이블 이관 롤백
*
* 이전 마이그레이션(2025_12_11_220200)에서 이관된 데이터를 정리하고
* items, item_id_mappings 테이블을 삭제합니다.
*
* 추후 items 테이블 정책 정리 후 재작업 예정
*/
return new class extends Migration
{
public function up(): void
{
// 1. items 테이블 데이터 삭제
if (Schema::hasTable('items')) {
$itemsCount = DB::table('items')->count();
echo "items 테이블 데이터 삭제: {$itemsCount}\n";
DB::table('items')->truncate();
}
// 2. item_id_mappings 테이블 삭제
if (Schema::hasTable('item_id_mappings')) {
$mappingsCount = DB::table('item_id_mappings')->count();
echo "item_id_mappings 테이블 삭제: {$mappingsCount}\n";
Schema::dropIfExists('item_id_mappings');
}
// 3. items 테이블 삭제
if (Schema::hasTable('items')) {
echo "items 테이블 삭제\n";
Schema::dropIfExists('items');
}
echo "✅ Items 관련 테이블 롤백 완료\n";
}
public function down(): void
{
// 롤백 시 아무 작업도 하지 않음
// items 테이블은 재설계 후 새로운 마이그레이션으로 생성 예정
echo "⚠️ 이 마이그레이션은 롤백되지 않습니다. items 테이블 재설계 후 새로운 마이그레이션을 사용하세요.\n";
}
};