File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,19 @@ grant pgsodium_keyiduser to postgres with admin option;
6
6
grant pgsodium_keyholder to postgres with admin option;
7
7
grant pgsodium_keymaker to postgres with admin option;
8
8
9
- create extension if not exists supabase_vault;
9
+ do $$
10
+ begin
11
+ if not exists (select from pg_extension where extname = ' supabase_vault' ) then
12
+ create extension supabase_vault;
13
+ -- Creating the extension creates a table and creates a security label on the table.
14
+ -- Creating the security label triggers a function that recreates these objects.
15
+ -- Since the recreation happens in an extension script, these objects become owned by the `supabase_vault` extension.
16
+ -- This is an issue because then we can't drop the extension without also dropping these objects.
17
+ -- Thus we drop the dependency on the `supabase_vault` extension for these objects.
18
+ alter extension supabase_vault drop view pgsodium .decrypted_key ;
19
+ alter extension supabase_vault drop function pgsodium .key_encrypt_secret ;
20
+ end if;
21
+ end;
22
+ $$;
10
23
11
24
-- migrate:down
You can’t perform that action at this time.
0 commit comments