make(Kernel::class)->bootstrap(); $identity = portalQaAssertTarget($target); $result = DB::transaction(function () { DB::statement('SET TRANSACTION READ ONLY'); return [ 'organization_columns' => DB::select("SELECT column_name,data_type FROM information_schema.columns WHERE table_schema='public' AND table_name='organizations' ORDER BY ordinal_position"), 'qa_memberships' => DB::table('memberships as m')->join('organizations as o', 'o.id', '=', 'm.organization_id')->whereIn('m.user_id', [18, 21, 22, 23, 24, 25, 29, 31])->whereNull('m.deleted_at')->get(['m.user_id', 'm.role', 'o.id', 'o.name', 'o.source_system', 'o.version_no']), 'categories' => DB::table('opportunities')->whereBetween('id', [30, 41])->get(['id', 'opportunity_category', 'status', 'management_version', 'workflow_context']), 'migration' => DB::table('migrations')->where('migration', 'like', '%organization%')->pluck('migration'), ]; }); file_put_contents($root.'/storage/app/private/investmoz-v2/portal-audit/next-consumers-inspection-qa.json', json_encode(['target' => $identity, 'result' => 'read_only', 'data' => $result], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); echo json_encode(['target' => $identity, 'columns' => $result['organization_columns'], 'qa_memberships' => $result['qa_memberships'], 'categories' => $result['categories']->map(fn ($r) => ['id' => $r->id, 'category' => $r->opportunity_category, 'status' => $r->status]), 'active_writes' => 0], JSON_UNESCAPED_UNICODE).PHP_EOL;