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

    Jacob Paris 🇨🇦

    11/22/2021, 6:48 PM
    Realm used to be just their real time database, while Stitch was their supabase-like offering, but it looks like they're merged now
  • j

    Jacob Paris 🇨🇦

    11/22/2021, 6:49 PM
    I've used Stitch to great enjoyment, but most of the reasons I used Mongo over SQL don't exist with Supabase
  • j

    Jacob Paris 🇨🇦

    11/22/2021, 6:49 PM
    namely that refactoring and migrating schemas is a nightmare but Supabase makes it painless
  • p

    Prodigy7kX

    11/23/2021, 3:17 AM
    i just created this function and trigger:
    Copy code
    create function public.handle_new_user() 
    returns trigger as $$
    begin
      insert into public.users (user_id, name, surname)
      values (new.id, new.raw_user_meta_data.first_name, new.raw_user_meta_data.last_name);
      return new;
    end;
    $$ language plpgsql security definer;
    create trigger on_auth_user_created
      after insert on auth.users
      for each row execute procedure public.handle_new_user();
  • p

    Prodigy7kX

    11/23/2021, 3:17 AM
    but now i wanna delete both
  • p

    Prodigy7kX

    11/23/2021, 3:17 AM
    i can see the function in the "functions" section of the dashboard
  • p

    Prodigy7kX

    11/23/2021, 3:18 AM
    but not the trigger
  • p

    Prodigy7kX

    11/23/2021, 3:18 AM
    and i can't delete the function without first deleting the trigger i believe
  • p

    Prodigy7kX

    11/23/2021, 3:24 AM
    nvm, i believe i got it with:
    DROP FUNCTION public.handle_new_user() CASCADE
  • p

    Prodigy7kX

    11/23/2021, 3:24 AM
    hopefully i didn't broke anything else by doing it
  • p

    Prodigy7kX

    11/23/2021, 3:41 AM
    Can I get the
    raw_user_meta_data
    via the function? If so, how? I tried and I was getting an Error trying to insert.
  • p

    Prodigy7kX

    11/23/2021, 3:53 AM
    nvm, i got it aswell, it was a syntax error
  • p

    Prodigy7kX

    11/23/2021, 3:53 AM
    just had to change it to:
    Copy code
    values (
        new.id, 
        new.raw_user_meta_data->>'first_name', 
        new.raw_user_meta_data->>'last_name'
      );
  • j

    jon.m

    11/23/2021, 4:39 AM
    @User how are you getting that to work
  • j

    jon.m

    11/23/2021, 4:40 AM
    are you passing first name and last name as the options object with the email signup method?
  • l

    Lio

    11/23/2021, 11:13 AM
    did https://app.supabase.io/api/login get yeeted? I'm trying to log in through vercel's integration and keep getting a 404
  • w

    wiesson

    11/23/2021, 11:16 AM
    I have a question regarding supabase-auth and different server urls (e.g. in feature branches) Lets assume my main page runs on
    example.com
    and I have a feature branch
    my-cool-fature.example-app.vercel.com
    - What do I need todo so that the emails from the feature branchs are pointing to that branch URL? (For example magic-link login, etc?)
  • p

    Prodigy7kX

    11/23/2021, 12:39 PM
    gotta pass another object to the signup method with the data
  • p

    Prodigy7kX

    11/23/2021, 12:42 PM
    it'd look something like this:
    Copy code
    const { user, session, error } = await supabase.auth.signUp(
      {
        email: 'example@email.com',
        password: 'example-password',
      },
      {
        data: { 
          first_name: 'John', 
          age: 27,
        }
      }
    )
  • f

    ferminrp

    11/23/2021, 1:52 PM
    Hey everyone, I have a very dumb question / problem you can probably help me with ... Let's say I have a table with a column name, and another last name. And I don't want to have to rows with the same combination of name-last name (duplicates) What would be the easiest way to reject post requests trying to add a duplicate or to clean duplicates periodically?
  • b

    batoms

    11/23/2021, 1:54 PM
    You can create a unique constraint on the the table so that the combination of those two values is always unique.
    f
    p
    • 3
    • 9
  • m

    MDobs

    11/23/2021, 2:23 PM
    is it normal that when I try to add a column to a table I get
    cannot drop constraint profiles_pkey on table profiles because other objects depend on it
    it is only update and I have done this 2-3 days ago with other columns, but not today for some reason
  • m

    MDobs

    11/23/2021, 2:26 PM
    hm when doing the same thing (add column) from the
    +
    button on the end of the table, it works...
  • j

    jon.m

    11/23/2021, 3:03 PM
    I feel like I was doing exactly what your doing and it wasn’t working. I guess I’ll try again.
  • p

    Prodigy7kX

    11/23/2021, 3:04 PM
    what were you trying to do?
  • j

    jon.m

    11/23/2021, 3:05 PM
    Add a full name field to profile table from raw user meta data.
  • j

    jon.m

    11/23/2021, 3:05 PM
    On signup
  • p

    Prodigy7kX

    11/23/2021, 3:05 PM
    oh, gotta create a function and trigger for that
  • j

    jon.m

    11/23/2021, 3:06 PM
    Yeah, I have one of those. I can only think some how I got the syntax wrong. I’ll have to give it another try.
  • j

    jon.m

    11/23/2021, 3:06 PM
    Thank you!
1...140141142...316Latest