https://supabase.com/ logo
Join Discord
Powered by
# help
  • n

    Nielsien

    12/02/2021, 10:34 AM
    👍 👍
  • e

    egnus

    12/02/2021, 10:36 AM
    I am using DataGrip to create the relationships because I can add the "onDelete" cascade, which is critical for the long term maintenance of the project
  • e

    egnus

    12/02/2021, 10:36 AM
    FYI
  • f

    fayaz

    12/02/2021, 10:57 AM
    New to the backend world, can someone help me solve this. I want each one of my users to have some data called
    integrations
    where they can only only edit the data. basically each user to be linked with a object, which has the integrations data. Use case - I want to capture the users UPI ID(a public payment handle in India), his google sheet id and his airtable base api key and ID, learning Supabase by building a finance tracker, Note that there will be only one integrations row per user. Please let me know if I am doing this the wrong way.
  • e

    egnus

    12/02/2021, 11:02 AM
    that looks like a 1 to 1 relationship, so you can add in both tables
    users -> integration_id
    and
    integrations -> user_id
    and query in any direction like with the JS SDK
    supabase.from('users').select('*, integration:integration_id(*)')
    and to edit with the SDK you can do like so
    supabase.from('integrations').update({OBJ TO UPDATE}).eq('user_id', USERID)
  • e

    egnus

    12/02/2021, 11:03 AM
    since this is 1 to 1, you can set
    user_id
    and
    integration_id
    as UNIQUE constraint and add index to them so queries run faster and the updates will work as expected
  • f

    fayaz

    12/02/2021, 11:03 AM
    How can I create this table? Also how to make sure one one row per user is added and not more
  • f

    fayaz

    12/02/2021, 11:04 AM
    Is this the right reference ? @User https://supabase-cheatsheet.vercel.app/docs/auth/public-profiles-table
  • e

    egnus

    12/02/2021, 11:04 AM
    for the second, UNIQUE constraint in
    user_id
    from
    integrations
  • e

    egnus

    12/02/2021, 11:05 AM
    no, that link does not talk about anything at all related to 1 to 1 relationships
  • e

    egnus

    12/02/2021, 11:07 AM
    I do all my DB with Datagrip so I am not very proficiency with SQL directly but the rules explained above is definitely what you need.
  • f

    fayaz

    12/02/2021, 11:07 AM
    Okay, thank you for the information, I will try to read more and see if I come up with something
  • e

    egnus

    12/02/2021, 11:08 AM
    search in internet 1 to 1 relationships Database design
  • e

    egnus

    12/02/2021, 11:09 AM
    although, 1 to 1 is in my opinion not a great aproach, since all can be stored in one single table and not in 2. But I can understand that this is sometimes desired for various reasons
  • i

    Ilko Kacharov

    12/02/2021, 12:11 PM
    The support team just replied to my ticket that they are aware of the realtime issue and that they're working on a fix. 🙌 It seems the problem is not big enough to post it to the status page.
  • d

    Deleted User

    12/02/2021, 12:11 PM
    Hello ! I have a big issue with my database right now, I have 502 errors when trying to sign in / sign up and errors on the auth system to
  • d

    Deleted User

    12/02/2021, 12:13 PM
    and for the error I have on some actions on my website : unhandledRejection: FetchError: invalid json response body at https://xbtlzxclftsapraugnfw.supabase.co/auth/v1/user reason: Unexpected token < in JSON at position 0
  • y

    YelloJello

    12/02/2021, 12:45 PM
    how do you troubleshoot a database error? aka a 500 error from Supabase? The response doesn't provide anything helpful. Asking because I'm currently getting a bunch of 500s when attempting to delete users via the auth.api.deleteUser() method
  • x

    Xyo

    12/02/2021, 12:45 PM
    @Deleted User use the Help button on the dashboard. Had the same issue and a restart didn’t fix it
  • d

    Deleted User

    12/02/2021, 12:46 PM
    Thank you @User , yes I also sent a message to the support
  • x

    Xyo

    12/02/2021, 12:46 PM
    In my case it was the instance just going zzz and needed a migration to another one
  • s

    schniz

    12/02/2021, 1:23 PM
    Hey there! First of all I want to say that the RLS feature is amazing. Thanks for the hard work! I have a question regarding it though (that I also tweeted: https://twitter.com/galstar/status/1466318414453121027?s=21) how would you design your tables, if you want to support realtime changes of the columns that policy is based on? i.e
    hidden
    flag that flips (and should act like a DELETE statement)
  • s

    schniz

    12/02/2021, 1:24 PM
    Maybe this should go to #913702831930888253
  • y

    YelloJello

    12/02/2021, 1:29 PM
    for anyone else that might have gone through this issue: https://github.com/supabase/storage-api/issues/65 apparently, if an authenticated user has uploaded anything to one of storage buckets, because the storage.objects table refers to auth.users.id, you won't be able to delete the user when you call auth.api.deleteUser(). Some documentation about this under the method would be really nice. Could've saved a couple hours of troubleshooting for me atleast.
  • m

    Muphet

    12/02/2021, 1:34 PM
    anyone else experiencing CORS block? its the first time i had that issue with sb
  • f

    fayaz

    12/02/2021, 5:49 PM
    I am hoping this is correct
    Copy code
    create table integrations (
      id uuid references auth.users UNIQUE NOT NULL,
      updated_at timestamp with time zone,
      airtable_key text unique,
      upi_handle text unique,
      inserted_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
      primary key (id)
    );
  • u

    user

    12/02/2021, 6:11 PM
    Hi! Anyone else having trouble connecting to Supabase? My app can't seem to connect, so I went into the SB dashboard and it gives me this message
  • x

    Xyo

    12/02/2021, 6:16 PM
    Same here
  • m

    Mihai

    12/02/2021, 6:27 PM
    it's working now
  • e

    ekko

    12/02/2021, 6:33 PM
    is it possible to order top-level results from an embedded resource? this is the query im trying to build in supabase/postgrest:
    Copy code
    SELECT site.* 
    FROM site JOIN address ON site.address_id = address.id
    ORDER BY address.name
    postgrest issue here: https://github.com/PostgREST/postgrest/issues/1414 has anyone figured out a workout around for this yet? i'm thinking of just creating an rpc that takes in a direction param for the ordering
1...148149150...316Latest