19 lines
1.5 KiB
PHP
19 lines
1.5 KiB
PHP
<?php
|
|
$root=dirname(__DIR__);$dir=$root.'/storage/app/private/investmoz-v2/portal-audit';
|
|
$plan=json_decode(file_get_contents($dir.'/portal-stability-latest.json'),true,512,JSON_THROW_ON_ERROR);
|
|
putenv('STABILITY_QA_MODE=consumers');
|
|
$app=require $plan['source'].'/tools/portal-stability-runtime.php';
|
|
use Illuminate\Support\Facades\DB;
|
|
$result=DB::transaction(function():array {
|
|
DB::statement('SET TRANSACTION READ ONLY');
|
|
$tables=[];
|
|
foreach(['investor_journeys','desk_cases','desk_requests','portal_partnerships','partnership_rooms','opportunities','portal_superuser_pair'] as $table){
|
|
$columns=DB::select("SELECT column_name FROM information_schema.columns WHERE table_schema='public' AND table_name=? ORDER BY ordinal_position",[$table]);
|
|
$names=array_column($columns,'column_name');$select=array_values(array_intersect($names,['id','user_id','owner_user_id','case_id','interest_id','status','organization_id','first_user_id','second_user_id','management_category','deleted_at']));
|
|
$tables[$table]=['columns'=>$names,'rows'=>DB::table($table)->orderBy('id')->get($select)->all()];
|
|
}
|
|
return ['result'=>'read_only_QA','tables'=>$tables,'active_writes'=>0];
|
|
});
|
|
file_put_contents($dir.'/portal-stability-consumer-index.json',json_encode($result,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
|
|
echo json_encode(['result'=>$result['result'],'table_counts'=>array_map(fn($t)=>count($t['rows']),$result['tables']),'pair'=>$result['tables']['portal_superuser_pair']['rows'],'active_writes'=>0]).PHP_EOL;
|