<?php
declare(strict_types=1);require __DIR__.'/connect.php';require __DIR__.'/schema.php';$check($dm&&$lane==='C','Only approved C readonly metadata');$raw=$schema('YOSHOP_EQUIPMENT');$baseline=json_decode(file_get_contents($runtime.'/equipment-schema-original.json'),true);$fresh=normalizeSchemaNumericMetadata($raw);$check($fresh===$baseline,'Explicit metadata-number-only normalization retains all exact schema values');$check((int)$q('SELECT COUNT(*) n FROM yoshop_equipment')[0]['n']===0&&count($fresh['columns'])===12&&count($fresh['indexes'])===4&&$fresh['triggers']===[],'Exact original rows0/columns12/indexes4/triggers0');$changes=[];foreach($raw as $group=>$rows)if(is_array($rows))foreach($rows as $n=>$row)if(is_array($row))foreach($row as $k=>$v)if(gettype($v)!==gettype($fresh[$group][$n][$k]))$changes[]=['path'=>$group.'.'.$n.'.'.$k,'raw_type'=>gettype($v),'persisted_type'=>gettype($fresh[$group][$n][$k]),'value'=>$fresh[$group][$n][$k]];$out=['business_DDL_started'=>is_file($runtime.'/ddl-apply.json'),'business_DML'=>0,'HTTP'=>0,'explicit_metadata_small_int_paths'=>$changes,'values_DDL_defaults_nullability_indexes_constraints_triggers_all_exact'=>true,'original_rows0'=>true,'original_metadata_sha256'=>hash('sha256',json_encode($baseline)),'fresh_same_serialization_sha256'=>hash('sha256',json_encode($raw))];$check($out['original_metadata_sha256']===$out['fresh_same_serialization_sha256'],'Same metadata serialized bytes values exact');file_put_contents(__DIR__.'/ddl-gate-C.json',json_encode($out,JSON_PRETTY_PRINT));echo json_encode(['HTTP'=>0,'business_DML'=>0,'business_DDL_started'=>$out['business_DDL_started'],'explicit_metadata_small_int_paths'=>count($changes),'all_schema_values_exact'=>true,'fresh_metadata_sha256'=>$out['fresh_same_serialization_sha256']]),"\n";
