Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

--use-migra command does not pick up a DB trigger that was created #1514

Open
rcwestlake opened this issue Sep 21, 2023 · 0 comments
Open

--use-migra command does not pick up a DB trigger that was created #1514

rcwestlake opened this issue Sep 21, 2023 · 0 comments

Comments

@rcwestlake
Copy link

Describe the bug
The npx supabase db diff --use-migra command is not picking a new db trigger that was created using the SQL editor locally. It did pick up the function that was created.

To Reproduce
Steps to reproduce the behavior:

  1. Run the CLI locally
  2. In the local host studio dashboard, run this in the SQL editor:
create function public.create_profile()
returns trigger
language plpgsql
security definer set search_path = public
as $$
begin
  insert into public.profiles (user_id)
  values (new.id);
  return new;
end;
$$;

create trigger create_profile_after_auth_user_insert
after insert on auth.users
for each row
execute procedure public.create_profile();
  1. You can verify that both the function and trigger are created in the studio dashboard
  2. Run the npx supabase db diff --use-migra command. This will create a new migration file.
  3. The migration file includes the command to create the function but not the trigger.
CREATE OR REPLACE FUNCTION public.create_profile()
 RETURNS trigger
 LANGUAGE plpgsql
 SECURITY DEFINER
 SET search_path TO 'public'
AS $function$
begin
  insert into public.profiles (user_id)
  values (new.id);
  return new;
end;
$function$
;

Expected behavior
The migration command should pick up the trigger that was created.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ventura 13.2.1
  • Browser (if applicable) [e.g. chrome, safari]
  • Version of CLI 1.99.5
  • Version of supabase-js (if applicable) ^2.36.0
  • Version of Node.js (if applicable) v20.5.1

Additional context
Add any other context about the problem here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants