5 lines
1.1 KiB
PHP
5 lines
1.1 KiB
PHP
<?php
|
|
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';
|
|
$out=[];foreach(['host'=>[$host,['a_clients','a_services','a_service_drafts','a_billing_drafts','permission_grants','sgf_presentation_profiles','wo_orders','wo_entries','wo_decisions','dc_rates','dc_calculations','ic_inputs','ic_results','sr_records','sr_effects']],'native'=>[$native,['pa_obligations','purchase_orders','requisitions','goods_receipts','invoices','stock_movements','gl_journals','gl_lines','gl_periods','ws_proposals','ws_allocations','ws_returns','budget_entries','budget_consumptions']]] as $name=>[$db,$tables]){$out[$name]=$db->transaction(function()use($db,$tables){$db->statement('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY');$rows=[];foreach($tables as $table)$rows[$table]=(array)$db->selectOne('SELECT count(*)::int records,md5(coalesce(string_agg(row_to_json(t)::text,chr(10) ORDER BY row_to_json(t)::text),\'\')) fingerprint FROM "'.$table.'" t');return $rows;});}
|
|
echo json_encode(['passed'=>true,'snapshot'=>$out,'database_writes'=>0,'other_databases_connected'=>false],JSON_THROW_ON_ERROR).PHP_EOL;
|