File tree Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -113,12 +113,48 @@ export function getCreateFDWSql({
113
113
const createServerSql = /* SQL */ `
114
114
do $$
115
115
declare
116
+ -- Old wrappers has an implicit dependency on pgsodium. For new wrappers
117
+ -- we use Vault directly.
118
+ is_using_old_wrappers bool;
116
119
${ encryptedOptions . map ( ( option ) => `v_${ option . name } text;` ) . join ( '\n' ) }
117
120
begin
121
+ is_using_old_wrappers := (select extversion from pg_extension where extname = 'wrappers') in (
122
+ '0.1.0',
123
+ '0.1.1',
124
+ '0.1.4',
125
+ '0.1.5',
126
+ '0.1.6',
127
+ '0.1.7',
128
+ '0.1.8',
129
+ '0.1.9',
130
+ '0.1.10',
131
+ '0.1.11',
132
+ '0.1.12',
133
+ '0.1.14',
134
+ '0.1.15',
135
+ '0.1.16',
136
+ '0.1.17',
137
+ '0.1.18',
138
+ '0.1.19',
139
+ '0.2.0',
140
+ '0.3.0',
141
+ '0.3.1',
142
+ '0.4.0',
143
+ '0.4.1',
144
+ '0.4.2',
145
+ '0.4.3',
146
+ '0.4.4',
147
+ '0.4.5'
148
+ );
118
149
${ encryptedOptions
119
150
. map (
120
- ( option ) =>
121
- /* SQL */ `select id into v_${ option . name } from pgsodium.valid_key where name = '${ formState . wrapper_name } _${ option . name } ' limit 1;`
151
+ ( option ) => /* SQL */ `
152
+ if is_using_old_wrappers then
153
+ select id into v_${ option . name } from pgsodium.valid_key where name = '${ formState . wrapper_name } _${ option . name } ' limit 1;
154
+ else
155
+ select id into v_${ option . name } from vault.secrets where name = '${ formState . wrapper_name } _${ option . name } ' limit 1;
156
+ end if;
157
+ `
122
158
)
123
159
. join ( '\n' ) }
124
160
You can’t perform that action at this time.
0 commit comments