require('dotenv').config({ path: '.env.local' }); const { Pool } = require('pg'); async function test() { const pool = new Pool({ connectionString: process.env.DATABASE_URL }); try { const res1 = await pool.query("SELECT id FROM fs_users WHERE data->>'email' = $1 LIMIT 1", [process.env.NEXT_PUBLIC_DEV_LOCAL_AUTH_EMAIL]); const userId = res1.rows[0].id; // The table is vibn_workspaces, not fs_workspaces const res2 = await pool.query("SELECT id, slug FROM vibn_workspaces WHERE owner_user_id = $1 LIMIT 1", [userId]); if (res2.rows.length === 0) { console.log("FAIL: User owns no workspaces."); return; } console.log("Workspace found:", res2.rows[0]); console.log("SUCCESS: The bypass SHOULD work."); } catch (e) { console.log("ERROR:", e.message); } finally { pool.end(); } } test();