full-stack-school/test-rls-sql.ts
2026-03-01 18:32:49 +00:00

14 lines
537 B
TypeScript

import "dotenv/config";
import { createClient } from "@supabase/supabase-js";
const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.SUPABASE_SERVICE_ROLE_KEY!);
async function main() {
const { data: students } = await supabase.from("Student").select("id").limit(1);
const id = students?.[0]?.id;
// We can execute raw SQL using the rpc or we can just send it.
// Wait, Supabase js doesn't support raw queries directly via the client without RPC.
console.log("Student ID:", id);
}
main();