migrateOptionStatusValues($context); } /** * order_options.option_status 값을 OrderStatusEnum 기준으로 변환합니다. * * @param UpgradeContext $context 업그레이드 컨텍스트 */ private function migrateOptionStatusValues(UpgradeContext $context): void { if (! Schema::hasTable('order_options')) { $context->logger->info('[v0.8.0] order_options 테이블이 없습니다. 스킵합니다.'); return; } // 변환 매핑: 이전 OrderOptionStatusEnum → 신규 OrderStatusEnum $mappings = [ 'pending' => 'pending_order', 'shipped' => 'shipping', 'return_requested' => 'cancelled', 'return_complete' => 'cancelled', 'exchange_requested' => 'cancelled', 'exchange_complete' => 'cancelled', 'refund_complete' => 'cancelled', ]; $totalUpdated = 0; foreach ($mappings as $oldValue => $newValue) { $count = DB::table('order_options') ->where('option_status', $oldValue) ->update(['option_status' => $newValue]); if ($count > 0) { $context->logger->info("[v0.8.0] option_status '{$oldValue}' → '{$newValue}': {$count}건 변환"); $totalUpdated += $count; } } $context->logger->info("[v0.8.0] option_status 값 마이그레이션 완료: 총 {$totalUpdated}건 변환"); } }