<?php
declare(strict_types=1);require __DIR__.'/native.php';ck(!file_exists($runtime.'/physical-money-final.json'),'Whole own monetary physical text once');$ids=json_decode(file_get_contents($runtime.'/prepared.json'),true)['ids'];$pre=json_decode(file_get_contents($runtime.'/preflight-'.$lane.'.json'),true);$out=[];foreach([['AI','user','user_id','user_id',[$ids['AI_U1'],$ids['AI_U2']]],['AI','account_settlement','settlement_id','user_id',[$ids['AI_U1'],$ids['AI_U2']]],['AI','user_balance_log','log_id','user_id',[$ids['AI_U1'],$ids['AI_U2']]],['ZHCT','meal_order','id','user_id',[$ids['STORE_U1'],$ids['STORE_U2']]]] as [$db,$table,$pk,$scope,$actors]){$fields=[];$metadata=[];foreach($pre['schema'][$db][$table]['columns'] as $c){$field=strtolower($c['column_name']);if(strtolower($c['data_type'])!=='decimal')continue;ck(preg_match('/^[a-z_]+$/D',$field)===1,'Frozen physical decimal column');$cast=$dm?'VARCHAR(80)':'CHAR';$fields[]='CAST('.$field.' AS '.$cast.') '.$field.'_text';$metadata[$field]=$c;}ck(count($fields)>0,'Whole original decimal schema list');$rows=readNative($db,'SELECT '.$pk.','.implode(',',$fields).' FROM '.($db==='AI'?'yoshop_':'ydy_').$table.' WHERE '.$scope.' IN (?,?) ORDER BY '.$pk,$actors);$out[$db.'.'.$table]=['metadata'=>$metadata,'rows'=>$rows];}saveOnce('physical-money-final.json',['lane'=>$lane,'whole_declared_DECIMAL_columns'=>$out,'native_values_kept_separately'=>'persistence-final.json full raw rows; no float epsilon or raw conversion','HTTP'=>0,'DML'=>0,'at'=>date('c')]);echo json_encode(['lane'=>$lane,'own_physical_decimal_tables'=>count($out),'SELECT'=>4,'HTTP'=>0,'DML'=>0]),"\n";
