Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

creates vault secrets with names when creating a fdw

Alaister Young4e858ed1e0cc
diff --git a/studio/data/fdw/fdw-create-mutation.ts b/studio/data/fdw/fdw-create-mutation.ts
index 3cd9483e406..f08e8b29054 100644
--- a/studio/data/fdw/fdw-create-mutation.ts
+++ b/studio/data/fdw/fdw-create-mutation.ts
@@ -37,11 +37,14 @@ export function getFDWCreateSql({
const value = formState[option.name] // TODO(alaister): escape '
return /* SQL */ `
- select pgsodium.create_key(name := '${key}');
+ select pgsodium.create_key(
+ name := '${key}'
+ );
- insert into vault.secrets (secret, key_id) values (
- '${value}',
- (select id from pgsodium.valid_key where name = '${key}')
+ select vault.create_secret (
+ new_secret := '${value}',
+ new_name := '${key}',
+ new_key_id := (select id from pgsodium.valid_key where name = '${key}')
);
`
})