From fe8dfd0bea76435d8723f087566b798bf7b817b8 Mon Sep 17 00:00:00 2001 From: gbuomprisco Date: Thu, 4 Jul 2024 21:04:00 +0800 Subject: [PATCH] Add condition to account creation trigger The trigger "add_current_user_to_new_account" has been updated to execute only when a new account is not personal. This adjustment to the trigger condition will ensure the function kit.add_current_user_to_new_account() only fires in these circumstances. --- apps/web/supabase/migrations/20221215192558_schema.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/supabase/migrations/20221215192558_schema.sql b/apps/web/supabase/migrations/20221215192558_schema.sql index ad0e4ed17..b113068a5 100644 --- a/apps/web/supabase/migrations/20221215192558_schema.sql +++ b/apps/web/supabase/migrations/20221215192558_schema.sql @@ -532,6 +532,7 @@ $$; -- trigger the function whenever a new account is created create trigger "add_current_user_to_new_account" after insert on public.accounts for each row +when (new.is_personal_account = false) execute function kit.add_current_user_to_new_account (); -- create a trigger to update the account email when the primary owner email is updated