Skip to content

Instantly share code, notes, and snippets.

@nikolasburk
Created October 10, 2022 07:06
Show Gist options
  • Save nikolasburk/2744cf4dd63fd2a6abd8c019c8d4ccdb to your computer and use it in GitHub Desktop.
Save nikolasburk/2744cf4dd63fd2a6abd8c019c8d4ccdb to your computer and use it in GitHub Desktop.
grant usage on schema public to supabase_auth_admin;
grant all on public."Profile" to supabase_auth_admin;
create or replace function create_profile_on_user_creation() returns trigger as
$$
begin
insert into
public."Profile"(id, "modifiedAt")
values(new.id, current_timestamp);
return new;
end;
$$
language plpgsql;
create trigger create_user
after insert on auth.users
for each row
execute procedure create_profile_on_user_creation();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment