I have like 20 hooks and don't want to manually cr...
# help
p
I have like 20 hooks and don't want to manually create them all
s
I'm guessing you want to create your functions and triggers through SQL, this is possible as this is all the Supabase UI is doing under the hood. Functions and Triggers are native to Postgres. You can create a function like:
Copy code
sql
-- inserts a row into public.users
create function public.handle_new_user()
returns trigger as $$
begin
    insert into public.users (id)
    values (new.id);
    return new;
end;
$$ language plpgsql security definer;
and a trigger for the function like:
Copy code
sql
-- trigger the function every time a user is created
create trigger on_auth_user_created
    after insert on auth.users
    for each row execute procedure public.handle_new_user();
p
Works perfectly!
I had an issue with my project but I made a new one and creating the triggers via SQL works
Thanks