cli
cli copied to clipboard
`--use-migra` command does not pick up a DB trigger that was created
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:
- Run the CLI locally
- 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();
- You can verify that both the function and trigger are created in the studio dashboard
- Run the
npx supabase db diff --use-migracommand. This will create a new migration file. - 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.