We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8c5f14c commit 50fa9abCopy full SHA for 50fa9ab
supabase/migrations/20241003131953_deployment.sql
@@ -190,15 +190,23 @@ end;
190
$$;
191
192
create function delete_secret(secret_id uuid)
193
-returns text
+returns bigint
194
language plpgsql
195
security definer set search_path = public
196
as $$
197
+declare
198
+ deleted_count bigint;
199
begin
200
if current_setting('role') != 'service_role' then
201
raise exception 'authentication required';
202
end if;
203
- return delete from vault.decrypted_secrets where id = secret_id;
204
+ with deleted as (
205
+ delete from vault.secrets where id = secret_id
206
+ returning *
207
+ )
208
+ select count(*) into deleted_count from deleted;
209
+
210
+ return deleted_count;
211
end;
212
0 commit comments