environment([EnvironmentName::PRODUCTOIN->value])) { $this->outputWarn("本番環境でないため、520以外はスキップします"); } $customers = MstCustomer::query() ->orderBy(MstCustomer::COL_NAME_ID) ->get(); foreach ($customers as $customer) { $this->handleCustomer($customer); } return self::RESULTCODE_SUCCESS; } private function handleCustomer(MstCustomer $customer) { // 本番環境のみ全顧客をマイグレーションする if (!app()->environment([EnvironmentName::PRODUCTOIN->value])) { if ( $customer->id !== 520 ) { return; } } // ## 暫定的に対象を絞り中 テスト中 if (!in_array($customer->id, [1, 520], true)) { return; } if (!HtpmsCustomerConnectionSwitch::isEnable($customer->id)) { $this->outputWarn(sprintf("存在しないスキーマのためスキップ htpms_%d (%s:%s)", $customer->id, $customer->customer_name, $customer->customer_id)); return; } HtpmsCustomerConnectionSwitch::switch($customer->id); try { $this->outputInfo(sprintf("start htpms_%d migration (%s:%s) ", $customer->id, $customer->customer_name, $customer->customer_id)); $this->call("migrate", ["--force" => true]); $this->outputInfo(sprintf("end htpms_%d migration (%s:%s)", $customer->id, $customer->customer_name, $customer->customer_id)); } catch (Exception $e) { print_r(DB::getConfig()); throw $e; } } }