https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Using Inheritance or not?
    m

    Mx

    12/27/2022, 2:51 AM
    I have a database schema with a table called "weapons" that currently meets my needs. However, I am having problems supporting different games because the fields in the "weapons" table, such as "RPM," "Magazine Size," and "Accuracy," do not apply to all types of weapons, such as melee weapons. I was considering using Postgres inheritance to create a generic "weapon" table and then adding game-specific tables as children of the generic table. Is this a viable solution? Also, here I'm sharing my current schema draft on miro: https://miro.com/app/board/uXjVPCGaUGY=/
    s
    • 2
    • 2
  • Update value with operator
    s

    sinrabo

    12/27/2022, 4:34 AM
    Can I update value base on value record Ex: {views: 1} -> {views:2}
    s
    • 2
    • 1
  • Best practices on scaling with Supabase or Postgres?
    f

    f

    12/27/2022, 5:08 AM
    I'm building out a consumer app which can have millions of users / day after our marketing. How should I best optimize my current code? and how can I optimize the supabase settings for this? Would greatly appreciate blog posts, documentation, or any resources to check out. Thank you!
    m
    • 2
    • 1
  • Type inference when selecting foreign table (Many-to-1)
    r

    Rizzaxc

    12/27/2022, 5:17 AM
    I'm taking an example from the POSTgrest doc: https://postgrest.org/en/stable/api.html#resource-embedding When querying for
    director
    from
    films
    , I can't seem to get correct TS typing from the generated types. The typing for
    data.director
    says
    director: {id, name} | director: {id, name}[] | null
    while I'd prefer it to only contain the singular variant, since my database schema enforces
    NOT NULL
    and the relationship is many to one (no plurals). How can I correct this? Typescript wouldn't let me use either form after the optional check and casting per here https://supabase.com/docs/reference/javascript/typescript-support doesn't seem to work
    s
    • 2
    • 4
  • sveltekit tutorial
    d

    DarthJarJar

    12/27/2022, 5:18 AM
    i'm trying to do the sveltekit quickstart tutorial from the website and i've been getting a bunch of errors
    s
    s
    c
    • 4
    • 20
  • Possible to create an user with both email and phone?
    f

    f

    12/27/2022, 6:58 AM
    It's very janky to use to create a user with one or the other and then update after that to include email or phone.
    g
    • 2
    • 3
  • Suggestions on how to handle media uploads in Supabase
    e

    ellie_dd

    12/27/2022, 7:56 AM
    Hi👋, I am a junior frontend dev and new to Supabase and still learning, hoping to get some guidance or directions to look for. Our team is trying to migrate an App from NextJs + RoR to NextJs Supabase. Now we have a form with multiple input datas and an image uploader - allow for multiple files to be uploaded. I tried the Storage function to upload files, but now I am confused about how this works with the other form datas? Do I just handle files in storage and other datas in database or is there a way to connect storage files to a database table? What would be best way to handle files in this case with Supabase ? I am hoping for any advices/examples to look at. Thanks a lot!!
    g
    • 2
    • 2
  • how to enable role permissions
    r

    Rama2l11

    12/27/2022, 8:38 AM
    How to enable role permissions 1. User can login 2. User can create database 3. Super user like permissions
    s
    • 2
    • 1
  • Schema not updating
    a

    ak4zh

    12/27/2022, 9:16 AM
    I had a table with
    bigint
    as primary key. I deleted the table and recreated new table with same name but
    uuid
    as primary key.. Now when I try to call
    await supabase.from('mytable').delete().eq('id', rowUUID)
    I get the following error:
    {"code":"22P02","details":null,"hint":null,"message":"invalid input syntax for type bigint: \"fb056279-c67c-4bd4-9b76-0e0c2c85822b\""}
    s
    s
    g
    • 4
    • 13
  • parsing form data in supabase edge function
    c

    Crownie

    12/27/2022, 9:32 AM
    in https://supabase.com/docs/reference/javascript/auth-admin-invoke it says
    Responses are automatically parsed as json, blob and form-data depending on the Content-Type header sent by your function. Responses are parsed as text by default.
    Responses are parsed as text by default.
    but how do i access the incoming form data
    • 1
    • 1
  • What is the best way to trigger an edge function on Postgres INSERT?
    l

    lake_mattiato

    12/27/2022, 10:34 AM
    I have a table Referral (id: uuid, client_id: foreign_key uuid, partner_id: foreign_key uuid, status: text) and on INSERT i want to create a trigger that will get the email of the partner_id (from the users table) and invoke an edge function.
    j
    • 2
    • 1
  • Migration Guide is gone since new Docs are available
    a

    activenode

    12/27/2022, 11:28 AM
    The link is dead / goes to the introduction: https://supabase.com/docs/reference/javascript/upgrade-guide
    s
    i
    • 3
    • 4
  • Send magic link to customers to complete their profiles
    a

    Aissam

    12/27/2022, 11:49 AM
    Hi everyone, thank you for your time in advance. Currently I’m developing a web app for some vendors. Vendors can log into their dashboards and add their own customers to keep track of their information. I’d like to add the following feature : when a vendor add a new customer via its email, the customer receives an email with a link allowing him to complete his data through a form (name, address…). I want the link to be available for only 1day. Can you help me please ?
  • Translate Command For Windows
    j

    jdgamble555

    12/27/2022, 12:56 PM
    I'm trying to translate this command line to work in Windows for Playwright testing:
    Copy code
    js
    function reseedDb() {
      execSync(
        "PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p 64322 -f supabase/clear-db-data.sql",
        { stdio: "ignore" }
      );
    }
    The script just truncates the users table:
    Copy code
    sql
    truncate table auth.users cascade;
    So how can I run this command in Windows for my local testing environment? Do I need a password (I don't see where a local Supabase DB has a password? Would my PGPASSWORD just be stored in my Windows ENV? This is from the Fireship Supabase course. Thanks, J
    • 1
    • 1
  • create a user with OAuth
    q

    quick_piper15

    12/27/2022, 2:22 PM
    Hey, how do you create a user with OAuth?
    s
    • 2
    • 1
  • External Service with Authentication
    t

    Tobias Grether

    12/27/2022, 3:00 PM
    Hello, I'm currently building a project which is mostly front-end, but part of a backend job is a pretty resource-heavy task involving encryption which requires file system access. Obviously Edge Functions don't fit here. My other idea was to create an external API server over REST to do this for me and spin it up in our own infrastructure. Question is here, how would I go about handling authentication? I still need RLS access to the supabase database from that external service. But since I cannot run my own service under the supabase domain, I won't be able to access the authentication cookie. What would be better solutions here?
    • 1
    • 1
  • pagination
    g

    garyaustin

    12/27/2022, 3:30 PM
    Count can be used as part of pagination. You use .limit() and .order() to do the pagination.
    c
    s
    • 3
    • 7
  • Cannot enable extensions from dashboard
    d

    debabrata

    12/27/2022, 4:53 PM
    I tried to enable
    pg_trgm
    extension from the dashboard but I'm getting the following error
    Copy code
    Failed to toggle PG_TRGM: failed to create pg.extensions: Connection terminated unexpectedly
    I tried installing other extensions as well, but I'm getting the same error.
    g
    • 2
    • 7
  • Database memory usage
    g

    Guy Rozen

    12/27/2022, 5:07 PM
    I have noticed that my memory usage is constantly around the 90%s. I cannot investigate why that's the case, as its only possible to view the logs of the last 24 hours. Is that the standard for free accounts? Are there some guidelines regarding where I should be looking for, for the sake of optimization? Keep in mind, the database size isn't large, and the fetched queries are relatively small.
    g
    • 2
    • 1
  • ReferenceError Can't find variable SharedArrayBuffer
    d

    Drip

    12/27/2022, 6:58 PM
    Trying to configure supabase-js locally to run with react-native in expo and running into this error.
  • Edge functions have stopped responding
    w

    will-estuary

    12/27/2022, 7:51 PM
    I have a couple of edge functions with my project that have completely stopped responding, with no apparent cause. Requests to this edge functions hang indefinitely, until the requesting client times out. Is there anything that would cause this & any potential resolution?
    a
    j
    g
    • 4
    • 7
  • Is there a way to force camel case in typescript types and queries
    d

    Drip

    12/27/2022, 8:26 PM
    while keeping snake_case in the db?
    g
    • 2
    • 2
  • Stripe wrapper limitations
    u

    49Ryann

    12/27/2022, 10:29 PM
    When I try and get more keys from the products table of Stripe I get this error:
    Copy code
    Failed to run sql query: target column number not match
    The blog example shows I can add a foreign table with certain keys & I then add metadata to it and it creates ok it's just when I query it I get the above error, should this not give me access to all available keys on the Stripe products type? Or is it just too early in development to support this?
    Copy code
    create foreign table products (
      id text,
      name text,
      description text,
      default_price text,
      metadata json   <----- Added this
    )
    server stripe_server
    options ( object 'products' );
    • 1
    • 1
  • RLS trouble
    p

    pkdiscgolf

    12/27/2022, 10:34 PM
    I am trying to get to the bottom of an issue I am having. I have a table, and i wish it to be "public". I set up my RLS with the intention that a logged in user would be able to update their "name" in the users_public table However, I am seeing an error when i attempt to insert : new row violates row-level security policy for table "users_public" Any advice to debugging this issue? I am using ReactJS with supabase auth/db
    u
    g
    • 3
    • 45
  • Can I remove the need of anon key for edge functions and make it for public use?
    f

    fridon

    12/27/2022, 11:29 PM
    If not, is there a way to customize a list of api keys which are not anon keys with access only for the edge function? My goal is to use edge function as a kind of api gateway for specific data aggregation.
    u
    • 2
    • 3
  • sql editor failed migration locked db
    r

    rocko

    12/28/2022, 12:53 AM
    My DB is stuck and not connecting. I see a notification that it was scheduled to run a a schema migration to "revoke superuser access". Apparently that is failing and I'm locked out of my DB project for the last few days. Anyone have ideas what I can do?
    Copy code
    Failed to finalize migration: An error has occurred: Failed to fetch
    s
    • 2
    • 5
  • What exactly happens when you sign in to Supabase outside of the browser?
    d

    DYELbrah

    12/28/2022, 2:46 AM
    I'm writing tests to verify RLS is setup correctly. To do this I'm logging in as certain users with certain roles. Within the browser, when a user login their token information is stored in localstorage? What happens when I trigger a login directly in NodeJS? Where is the token stored or how does Supabase know which user is logged in after the initial request?
    j
    g
    • 3
    • 7
  • How to invite a user
    j

    jar

    12/28/2022, 3:45 AM
    I see an invite user email template. How might I go about utilizing that. Would I have users add a row to a table of emails they wish to invite then is there a subabase js func to trigger emails as admin user or something or a plpgsql trigger func that triggers the email
    s
    • 2
    • 1
  • What is the best way to join, with value from table?
    r

    royboy789

    12/28/2022, 4:16 AM
    Hello, relatively new here, and SQL is something I'm dangerously adequate with. I'm using the JS SDK, and see that I can join pretty easily, and filter on those joins. I have 2 tables (media and galleries) and a reference table. I'd like to call the reference table
    media_gallery_rel
    with the media_id. Goal would be to have a list of all media, with their associated galleries(by id). I can worry about grabbing data form the galleries table later, unless I can bring that in too?
    Copy code
    .eq('media_gallery_rel.media_id', some_id);
    this works if I pass in the
    some_id
    but is it possible to do this dynamically without 2 SELECT's? or do I have to select all media, then loop through and call the relationship? this returns empty array:
    Copy code
    eq('media_gallery_rel.media_id', 'photos.media_id');
    ^ photos is media, old scope name
    s
    • 2
    • 2
  • Disable Auth on local development?
    f

    f

    12/28/2022, 7:46 AM
    Supabase CLI doesn't support simulating auth locally. How can we disable auth when doing local development?
    s
    • 2
    • 20
1...808182...230Latest