supabase icon indicating copy to clipboard operation
supabase copied to clipboard

Enable optional schema override

Open dninet opened this issue 2 years ago • 6 comments

It would be nice to make it possible to override the default schema. It's a non-breaking-change.

Types of changes

  • [ ] Bug fix (a non-breaking change which fixes an issue)
  • [x] New feature (a non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Description

By giving the useSupabaseClient this optional parameter, the schema-selection is not limited to public.

This enables very easy schema selection which is useful for more complex databases.

Checklist:

  • [x] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my changes (if not applicable, please state why)

The change seems too minor to test.

dninet avatar Aug 03 '22 10:08 dninet

Deploy Preview for supabase-module canceled.

Name Link
Latest commit 6385a224d2d29e860f16267502557c928243ad56
Latest deploy log https://app.netlify.com/sites/supabase-module/deploys/62ea531dce98d3000847d4cc

netlify[bot] avatar Aug 03 '22 10:08 netlify[bot]

@josuemartinezz could you review this? I currently need to bypass this by manually overriding the protected property schema which my linter and IDE do not like. Having exceptions all over my project is ugly :/.

dninet avatar Aug 03 '22 15:08 dninet

Hey @AlbertDavid94, thanks for the proposal. However you can override the schema in your nuxt.config.ts, using the client option: https://supabase.nuxtjs.org/get-started#options

Does it make the job ?

larbish avatar Aug 09 '22 08:08 larbish

@larbish the configuration option would still limit the number of schemas. I use multiple schemas in my project.

dninet avatar Aug 09 '22 11:08 dninet

Ok I understand. However, your code won't work because the client is created only once then share through the nuxtApp. An option could be to recreate the client if options are passed as parameter of the client. We could be able to override all options instead of only the schema one.

larbish avatar Aug 16 '22 08:08 larbish

@larbish sounds good to me. I'll review and update my code tomorrow.

dninet avatar Aug 16 '22 17:08 dninet