make(Kernel::class)->bootstrap(); DB::statement('SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY'); $actual = DB::selectOne('SELECT current_database() AS database, inet_server_port() AS port'); if ($actual->database !== 'investemoz' || (int) $actual->port !== 5432) { throw new RuntimeException('Expected active read-only identity; no mutation performed.'); } $result = ['target' => $actual, 'transaction_read_only' => DB::selectOne('SHOW transaction_read_only')->transaction_read_only, 'legacy_available' => app(LegacyContent::class)->available(), 'legacy_documents' => DB::table('documents')->where('external_id', 'like', 'legacy-tempo-%')->count(), 'installed_queried_migrations' => DB::table('migrations')->where(function ($query) { $query->where('migration', 'like', '%030000%')->orWhere('migration', 'like', '%040000%')->orWhere('migration', 'like', '%190000%'); })->pluck('migration'), 'active_bundle_sha256' => hash_file('sha256', public_path('build/manifest.json')), 'active_writes' => 0]; $result['required_extensions_installed'] = []; foreach (['2026_10_09_030000_extend_opportunity_resources', '2026_10_10_040000_create_portal_profile_authorization', '2026_10_09_190000_prepare_investor_path'] as $migration) { $result['required_extensions_installed'][$migration] = DB::table('migrations')->where('migration', $migration)->exists(); } file_put_contents(storage_path('app/private/investmoz-v2/portal-audit/legacy-active-readonly.json'), json_encode($result, JSON_PRETTY_PRINT)); echo json_encode($result);