selectOne('SELECT current_database() AS database, inet_server_port() AS port'); if($target!==['database'=>'stability_consumers_20261011_084534_test','port'=>55441])throw new RuntimeException('QA only'); $db->beginTransaction();$db->statement('SET TRANSACTION READ ONLY'); try{ $b=app(App\Services\Mne\BusinessRepository::class)->find('172aa874-98fc-4bf6-b78f-d2e9a386d345'); $transitions=$db->table('business_workflow_transitions')->where('existing_business_id',$b->id)->orderBy('created_at')->get(['from_status','to_status','actor_id','created_at','metadata']); $revisions=$db->table('existing_business_revisions')->where('business_id',$b->id)->orderBy('version_no')->get(['version_no','action','created_at']); $p=['target'=>$target,'SQL_read_only'=>true,'business_id'=>$b->id,'owner'=>$b->owner_user_id,'status'=>$b->status,'version'=>$b->version_no,'transitions'=>$transitions,'revisions'=>$revisions,'public_url'=>'https://portal-investidor.test:18445/negocios/'.$b->public_slug,'active_changes'=>0]; $path=__DIR__.'/line07-consolidated-SQL-20261015.json'; if(is_file($path))throw new RuntimeException('Preserve evidence'); file_put_contents($path,json_encode($p,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES).PHP_EOL); echo json_encode($p,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); }finally{$db->rollBack();}