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

    garyaustin

    02/13/2022, 3:47 PM
    cache files in app
  • y

    Yonben

    02/13/2022, 4:05 PM
    @User how to handle migrations between ui/sql. I create my tables on the UI, worked on my project etc... Then I needed to make a change so I
    supabase migration new <name>
    and wrote my migration, but when I try to
    supabase db push
    it I get the following:
    Copy code
    ▶ supabase db push
    \Applying unapplied migrations...
    Error: ERROR: must be owner of table summoners (SQLSTATE 42501)
    Now if I look at the initial "remote_commit" migration, it states the owner is
    supabase_admin
    but it also granted
    ALL
    on the table, so I'm confused 🤷🏻‍♂️
    Copy code
    ALTER TABLE IF EXISTS public.summoners
        OWNER to supabase_admin;
    
    ALTER TABLE IF EXISTS public.summoners
        ENABLE ROW LEVEL SECURITY;
    
    GRANT ALL ON TABLE public.summoners TO anon;
    
    GRANT ALL ON TABLE public.summoners TO authenticated;
    
    GRANT ALL ON TABLE public.summoners TO postgres;
    
    GRANT ALL ON TABLE public.summoners TO service_role;
    
    GRANT ALL ON TABLE public.summoners TO supabase_admin;
    If I run the query on the UI, and then do a
    remote commit
    I get a really weirdly generated migration so I'd like to avoid the unnecessary overhead from these:
    Copy code
    REVOKE ALL ON TABLE public.summoners FROM anon;
    REVOKE ALL ON TABLE public.summoners FROM authenticated;
    REVOKE ALL ON TABLE public.summoners FROM postgres;
    REVOKE ALL ON TABLE public.summoners FROM service_role;
    REVOKE ALL ON TABLE public.summoners FROM supabase_admin;
    GRANT ALL ON TABLE public.summoners TO anon;
    
    GRANT ALL ON TABLE public.summoners TO authenticated;
    
    GRANT ALL ON TABLE public.summoners TO postgres;
    
    GRANT ALL ON TABLE public.summoners TO service_role;
    
    GRANT ALL ON TABLE public.summoners TO supabase_admin;
    • 1
    • 1
  • y

    Yonben

    02/13/2022, 4:35 PM
    UI - Local migrations ownership
  • p

    Paul AKA TDI

    02/13/2022, 6:45 PM
    Hi! I am trying to run through the https://supabase.com/docs/guides/with-svelte and when I run npm run dev I keep getting the error
    Copy code
    > svelte-app@1.0.0 dev /Users/bob/Documents/dev/javascript/svelte/supabase-svelte
    > rollup -c -w
    
    sh: rollup: command not found
    my rollup.config.js looks like this
    s
    • 2
    • 1
  • a

    atmanaut.eth

    02/13/2022, 7:08 PM
    Yes, that's a key part. And making sure not to add spaces after the comma-separated redirect URLs, as that's an open issue. But to no avail. I also use third-party OAuth and the redirect doesn't seem to take there either. I see it in the query string and in the response.location. It seems like the bug might be in my svelte-kit request handler or layout load function, but I can't find it for the life of me
  • a

    atmanaut.eth

    02/13/2022, 7:09 PM
    Yes, I turned up a few related issues, seems tricky for a number of us
  • a

    atmanaut.eth

    02/13/2022, 7:18 PM
    Naw, that's just the name my momma gave me 😛
  • a

    atmanaut.eth

    02/13/2022, 7:18 PM
    that's rad. congrats on the magic!
  • a

    atmanaut.eth

    02/13/2022, 7:19 PM
    I'm gonna try manually updating the go-true dependency
  • s

    silentworks

    02/13/2022, 8:45 PM
    Svelte example erroring
  • a

    AmusedGrape

    02/13/2022, 11:07 PM
    is there a way i can search by part of a UUID? like just the first section?
  • g

    garyaustin

    02/13/2022, 11:29 PM
    From js use .like() with a regex expression ending in -... if in SQL probably a faster way.
  • a

    AmusedGrape

    02/13/2022, 11:29 PM
    i'm trying this:
    Copy code
    js
        const { data, error } = await supabaseServer.from("moderation_actions").select('*').like('id::text', `%${id}%`).single();
    i get an error:
    operator does not exist: uuid ~~ unknown
    i tried the same thing in the sql editor:
    SELECT * FROM moderation_actions WHERE id::text LIKE '%b5dcc38d%'
    that worked fine
  • g

    garyaustin

    02/13/2022, 11:51 PM
    Not sure. I use query = query.ilike(filter.col,
    %${filter.val.toLowerCase()}%
    ) THERE ARE ` around the %... not sure how to format here
  • a

    AmusedGrape

    02/14/2022, 12:00 AM
    nah its fine lol
  • a

    AmusedGrape

    02/14/2022, 12:01 AM
    yeah that still didnt work for some reason
  • m

    magicbyt3

    02/14/2022, 8:31 AM
    Hi all, I am trying to update some table based on a column in another table but I am not sure about the sql required, this is what I have right now: table one: profiles table two: memberships
    Copy code
    sql
    UPDATE profiles SET counter = CASE
       WHEN memberships.level = 0 THEN counter + 1
       WHEN memberships.level = 1 THEN counter + 3
       WHEN memberships.level = 2 THEN counter + 6
       WHEN memberships.level = 3 THEN counter + 9
    END
    however I get an error missing FROM-clause entry for table "memberships" How would that work? Thanks in advance. /edit: solved
  • z

    ze

    02/14/2022, 10:41 AM
    Hello, I'm trying to upload an image into storage, but the upload doesn't go through completly. I only get like 13-16kb of size in the stored object. I'm not sure why this happens, yesterday i managed to upload an image successfully. I have today made some changes (changed the upload dir to a new folder), and now neither folder works. They have the same permissions. i get back a successful upload confirmation, so i'm wondering where is the issue
  • z

    ze

    02/14/2022, 10:42 AM
    Copy code
    javascript
    export async function uploadLogo(logo) {
        const id = uuid();
        const { data, error } = await supabaseClient.storage.from('tmp').upload(`logos/${id}.png`, logo, {
            // TODO should cache for logos be increased?
            cacheControl: '3600',
            upsert: false
        });
        if (error) {
            throw error;
        }
    
        console.log('upload', data, error);
        return id;
    }
  • z

    ze

    02/14/2022, 10:44 AM
    this is my upload code. If i run logo.size i get the right size. I'm getting a
    File
    uploaded and converting it to
    arrayBuffer
    (on the endpoint), since
    File
    isn't supported by node-fetch, apparently.
  • z

    ze

    02/14/2022, 10:45 AM
    Copy code
    sql
    ((bucket_id = 'tmp'::text) AND (lower((storage.foldername(name))[1]) = 'public'::text) AND (role() = 'anon'::text))
  • z

    ze

    02/14/2022, 10:45 AM
    this is the general policy i have atm for the folders for all CRUD verbs. (i'm at poc stage, will update the policies accordingly later)
  • z

    ze

    02/14/2022, 10:47 AM
    insert policy for storage.objects 😁
  • z

    ze

    02/14/2022, 10:48 AM
    i'm running out of debug angles as the image has the correct size on my end, gets sent through the client and gets a successful reply back. I'm not blaming the the client as it worked yesterday and i haven't made any changes in dependencies
  • z

    ze

    02/14/2022, 10:49 AM
    thanks in advance, i'm a bit lost here 😥
  • v

    valentin ッ

    02/14/2022, 3:12 PM
    Hi, quick question: How could i get all the users that come from a specific country from a table
  • v

    valentin ッ

    02/14/2022, 3:12 PM
    instead of getting all the users.
  • v

    valentin ッ

    02/14/2022, 3:13 PM
    thanks in advance, valentin.
  • s

    stnmonroe

    02/14/2022, 3:32 PM
    Is there a way to add the
    user_id
    of the user making the request to a row, ie
    created_by
    , without having to add that id from the client every time? Thanks in advance!
  • g

    garyaustin

    02/14/2022, 3:52 PM
    Make the default for the column auth.uid().
1...220221222...316Latest