nuxt-modules / supabase

Supabase module for Nuxt.
https://supabase.nuxtjs.org
MIT License
733 stars 129 forks source link

How to access multiple schemas? #355

Closed MalachiDraven closed 6 months ago

MalachiDraven commented 6 months ago

Hi there. I was wondering if there's a way to access multiple schemas somehow, or have I been creating my tables wrong? I like to keep things organized, so I use the public schema for things like user profiles, but then I also have custom schemas like "shop" and "blog", just to keep my Supabase Dashboard neat and tidy. Is there a way to access the public schema on one of my Nuxt pages, but my "shop" schema on another page?

MalachiDraven commented 6 months ago

Ha, of course, as always whenever I ask a question, I figure it out myself like 5 minutes later. It never fails lol.

If anyone else comes across this post while trying to do the same thing, it's as easy as this:

const { data, error } = await supabase.schema("shop").from("products")

Also make sure you've granted all permissions - https://supabase.com/docs/guides/api/using-custom-schemas