create-expo-updates-server 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/template/.env.docker.example +1 -0
- package/dist/template/.env.example +2 -0
- package/dist/template/README.md +16 -8
- package/dist/template/app/api/admin/distribution-control/route.test.ts +153 -0
- package/dist/template/app/api/admin/distribution-control/route.ts +111 -0
- package/dist/template/app/api/admin/embedded-updates/route.test.ts +36 -1
- package/dist/template/app/api/admin/guard-actions/[id]/route.test.ts +60 -0
- package/dist/template/app/api/admin/guard-actions/[id]/route.ts +32 -0
- package/dist/template/app/api/admin/guard-actions/route.test.ts +123 -0
- package/dist/template/app/api/admin/guard-actions/route.ts +66 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +4 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/policy/route.test.ts +171 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/policy/route.ts +75 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +4 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +4 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +4 -1
- package/dist/template/app/api/admin/updates/route.test.ts +29 -1
- package/dist/template/app/updates/[encodedKey]/page.tsx +74 -6
- package/dist/template/app/updates/embedded/page.tsx +6 -2
- package/dist/template/app/updates/page.tsx +28 -3
- package/dist/template/docs/expo-app-setup.md +14 -3
- package/dist/template/docs/getting-started.md +13 -7
- package/dist/template/docs/getting-started.ru.md +15 -7
- package/dist/template/docs/migrations/2026-09-01-app-version-columns.sql +23 -0
- package/dist/template/docs/migrations/2026-09-01-ota-update-policy.sql +108 -0
- package/dist/template/docs/migrations/2026-09-01-p1-guard-actions.sql +19 -0
- package/dist/template/docs/migrations/2026-09-01-p2-simplify-ota-guard-policy.sql +69 -0
- package/dist/template/docs/migrations/2026-09-01-policy-publication-correction.sql +44 -0
- package/dist/template/docs/migrations/2026-09-02-ota-distribution-control.sql +377 -0
- package/dist/template/docs/migrations/schema.sql +561 -2
- package/dist/template/docs/operations-guide.md +52 -1
- package/dist/template/docs/ota-emergency-recovery.md +22 -0
- package/dist/template/docs/ota-update-policy.md +89 -0
- package/dist/template/docs/supabase-setup.md +2 -1
- package/dist/template/package-lock.json +2 -2
- package/dist/template/package.json +1 -1
- package/dist/template/scripts/configure-expo-app.mjs +6 -0
- package/dist/template/scripts/lib/embedded-update-registrar.test.ts +383 -3
- package/dist/template/scripts/lib/expo-app-configurator.mjs +165 -9
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +658 -9
- package/dist/template/src/client/admin-api.ts +80 -1
- package/dist/template/src/client/admin-types.ts +52 -2
- package/dist/template/src/client/distribution-control.tsx +231 -0
- package/dist/template/src/client/guard-action-combobox.test.ts +26 -0
- package/dist/template/src/client/guard-action-combobox.tsx +267 -0
- package/dist/template/src/client/guard-action-options.test.ts +62 -0
- package/dist/template/src/client/guard-action-options.ts +70 -0
- package/dist/template/src/client/update-policy-editor.test.ts +36 -0
- package/dist/template/src/client/update-policy-editor.tsx +436 -0
- package/dist/template/src/server/controllers/assets.test.ts +87 -0
- package/dist/template/src/server/controllers/assets.ts +26 -0
- package/dist/template/src/server/controllers/manifest.test.ts +413 -2
- package/dist/template/src/server/controllers/manifest.ts +103 -38
- package/dist/template/src/server/lib/admin-distribution-guard.test.ts +61 -0
- package/dist/template/src/server/lib/admin-embedded-updates.test.ts +57 -0
- package/dist/template/src/server/lib/admin-embedded-updates.ts +42 -25
- package/dist/template/src/server/lib/admin-update-policy.test.ts +176 -0
- package/dist/template/src/server/lib/admin-updates.test.ts +133 -0
- package/dist/template/src/server/lib/admin-updates.ts +174 -9
- package/dist/template/src/server/lib/distribution-control-migration.test.ts +94 -0
- package/dist/template/src/server/lib/distribution-control.test.ts +160 -0
- package/dist/template/src/server/lib/distribution-control.ts +250 -0
- package/dist/template/src/server/lib/guard-actions-migration.test.ts +56 -0
- package/dist/template/src/server/lib/guard-actions.test.ts +142 -0
- package/dist/template/src/server/lib/guard-actions.ts +106 -0
- package/dist/template/src/server/lib/ota-policy-migrations.test.ts +64 -0
- package/dist/template/src/server/lib/simple-policy-migration.test.ts +97 -0
- package/dist/template/src/server/lib/supabase.js +95 -8
- package/dist/template/src/server/lib/supabase.test.ts +194 -0
- package/dist/template/src/server/lib/update-policy.test.ts +98 -0
- package/dist/template/src/server/lib/update-policy.ts +171 -0
- package/dist/template/src/server/manifest/manifest-repository.ts +10 -1
- package/dist/template/src/server/manifest/manifest-response.ts +0 -16
- package/dist/template/src/server/manifest/manifest-values.test.ts +54 -0
- package/dist/template/src/server/manifest/manifest-values.ts +145 -0
- package/dist/template/templates/expo-app/ci_scripts/ci_post_xcodebuild.sh +23 -1
- package/dist/template/templates/expo-app/plugins/with-ota-embedded-registration.js +13 -4
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +53 -7
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/register-ios.sh +87 -0
- package/dist/template/tsconfig.json +4 -1
- package/dist/template-manifest.json +283 -88
- package/package.json +1 -1
- package/dist/template/templates/expo-app/ci_scripts/register-embedded-update.sh +0 -36
- /package/dist/template/templates/expo-app/scripts/ota-register-embedded/{android-register-embedded-update.sh → register-android.sh} +0 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
create table if not exists public.ota_distribution_control (
|
|
2
|
+
singleton_id smallint primary key default 1,
|
|
3
|
+
blocked boolean not null default false,
|
|
4
|
+
version bigint not null default 1,
|
|
5
|
+
reason text null,
|
|
6
|
+
changed_at timestamptz not null default now(),
|
|
7
|
+
changed_by jsonb not null default
|
|
8
|
+
'{"type":"system","id":"migration","label":"Database migration"}'::jsonb,
|
|
9
|
+
constraint ota_distribution_control_singleton_chk check (singleton_id = 1),
|
|
10
|
+
constraint ota_distribution_control_version_chk check (version > 0),
|
|
11
|
+
constraint ota_distribution_control_reason_chk check (
|
|
12
|
+
(not blocked and reason is null)
|
|
13
|
+
or (
|
|
14
|
+
blocked
|
|
15
|
+
and reason = btrim(reason)
|
|
16
|
+
and char_length(reason) between 1 and 500
|
|
17
|
+
and reason !~ '[[:cntrl:]]'
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
insert into public.ota_distribution_control (
|
|
23
|
+
singleton_id,
|
|
24
|
+
blocked,
|
|
25
|
+
version,
|
|
26
|
+
reason,
|
|
27
|
+
changed_by
|
|
28
|
+
)
|
|
29
|
+
values (
|
|
30
|
+
1,
|
|
31
|
+
false,
|
|
32
|
+
1,
|
|
33
|
+
null,
|
|
34
|
+
'{"type":"system","id":"migration","label":"Database migration"}'::jsonb
|
|
35
|
+
)
|
|
36
|
+
on conflict (singleton_id) do nothing;
|
|
37
|
+
|
|
38
|
+
create table if not exists public.ota_distribution_control_events (
|
|
39
|
+
id bigserial primary key,
|
|
40
|
+
previous_blocked boolean not null,
|
|
41
|
+
blocked boolean not null,
|
|
42
|
+
previous_version bigint not null,
|
|
43
|
+
version bigint not null,
|
|
44
|
+
reason text null,
|
|
45
|
+
changed_at timestamptz not null,
|
|
46
|
+
changed_by jsonb not null,
|
|
47
|
+
constraint ota_distribution_control_events_versions_chk check (
|
|
48
|
+
previous_version > 0 and version = previous_version + 1
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
create index if not exists idx_ota_distribution_control_events_changed_at
|
|
53
|
+
on public.ota_distribution_control_events (changed_at desc);
|
|
54
|
+
|
|
55
|
+
-- Serialize the emergency switch with every mutation that can start or
|
|
56
|
+
-- redirect OTA distribution. A transaction that gets this lock first is the
|
|
57
|
+
-- operation that takes effect first; the other transaction observes its
|
|
58
|
+
-- committed result after waiting. Keep this lock first in every code path
|
|
59
|
+
-- before taking row locks to avoid lock-order inversions.
|
|
60
|
+
create or replace function public.lock_ota_distribution_control()
|
|
61
|
+
returns void
|
|
62
|
+
language sql
|
|
63
|
+
set search_path = pg_catalog
|
|
64
|
+
as $$
|
|
65
|
+
select pg_catalog.pg_advisory_xact_lock(20260902, 1);
|
|
66
|
+
$$;
|
|
67
|
+
|
|
68
|
+
revoke all on function public.lock_ota_distribution_control() from public;
|
|
69
|
+
|
|
70
|
+
create or replace function public.serialize_ota_distribution_statement()
|
|
71
|
+
returns trigger
|
|
72
|
+
language plpgsql
|
|
73
|
+
security definer
|
|
74
|
+
set search_path = public, pg_temp
|
|
75
|
+
as $$
|
|
76
|
+
begin
|
|
77
|
+
perform public.lock_ota_distribution_control();
|
|
78
|
+
return null;
|
|
79
|
+
end;
|
|
80
|
+
$$;
|
|
81
|
+
|
|
82
|
+
-- This statement-level trigger also serializes ordinary direct SQL updates
|
|
83
|
+
-- of the singleton. The RPC explicitly takes the same lock before touching
|
|
84
|
+
-- the row.
|
|
85
|
+
drop trigger if exists trg_ota_distribution_control_serialize_write
|
|
86
|
+
on public.ota_distribution_control;
|
|
87
|
+
create trigger trg_ota_distribution_control_serialize_write
|
|
88
|
+
before insert or update or delete on public.ota_distribution_control
|
|
89
|
+
for each statement
|
|
90
|
+
execute function public.serialize_ota_distribution_statement();
|
|
91
|
+
|
|
92
|
+
-- Acquire the lock before PostgreSQL starts locking affected update/channel
|
|
93
|
+
-- rows. The row triggers below take it again (reentrantly) only when they need
|
|
94
|
+
-- to check BLOCKED, but the statement triggers establish a consistent global
|
|
95
|
+
-- lock order for multi-row and direct-SQL mutations.
|
|
96
|
+
drop trigger if exists trg_ota_distribution_serialize_update_insert
|
|
97
|
+
on public.ota_updates;
|
|
98
|
+
create trigger trg_ota_distribution_serialize_update_insert
|
|
99
|
+
before insert on public.ota_updates
|
|
100
|
+
for each statement
|
|
101
|
+
execute function public.serialize_ota_distribution_statement();
|
|
102
|
+
|
|
103
|
+
drop trigger if exists trg_ota_distribution_serialize_update_activation
|
|
104
|
+
on public.ota_updates;
|
|
105
|
+
create trigger trg_ota_distribution_serialize_update_activation
|
|
106
|
+
before update of is_active on public.ota_updates
|
|
107
|
+
for each statement
|
|
108
|
+
execute function public.serialize_ota_distribution_statement();
|
|
109
|
+
|
|
110
|
+
drop trigger if exists trg_ota_distribution_serialize_channel_insert
|
|
111
|
+
on public.ota_update_channels;
|
|
112
|
+
create trigger trg_ota_distribution_serialize_channel_insert
|
|
113
|
+
before insert on public.ota_update_channels
|
|
114
|
+
for each statement
|
|
115
|
+
execute function public.serialize_ota_distribution_statement();
|
|
116
|
+
|
|
117
|
+
drop trigger if exists trg_ota_distribution_serialize_channel_change
|
|
118
|
+
on public.ota_update_channels;
|
|
119
|
+
create trigger trg_ota_distribution_serialize_channel_change
|
|
120
|
+
before update of
|
|
121
|
+
runtime_version,
|
|
122
|
+
channel,
|
|
123
|
+
platform,
|
|
124
|
+
latest_update_id,
|
|
125
|
+
latest_created_at,
|
|
126
|
+
latest_created_at_path,
|
|
127
|
+
active_update_id,
|
|
128
|
+
active_changed_at,
|
|
129
|
+
served_manifest_id,
|
|
130
|
+
served_manifest_changed_at
|
|
131
|
+
on public.ota_update_channels
|
|
132
|
+
for each statement
|
|
133
|
+
execute function public.serialize_ota_distribution_statement();
|
|
134
|
+
|
|
135
|
+
create or replace function public.assert_ota_distribution_mutation_allowed(
|
|
136
|
+
p_operation text
|
|
137
|
+
)
|
|
138
|
+
returns void
|
|
139
|
+
language plpgsql
|
|
140
|
+
security definer
|
|
141
|
+
set search_path = public, pg_temp
|
|
142
|
+
as $$
|
|
143
|
+
declare
|
|
144
|
+
distribution_blocked boolean;
|
|
145
|
+
begin
|
|
146
|
+
perform public.lock_ota_distribution_control();
|
|
147
|
+
|
|
148
|
+
select blocked
|
|
149
|
+
into distribution_blocked
|
|
150
|
+
from public.ota_distribution_control
|
|
151
|
+
where singleton_id = 1
|
|
152
|
+
for share;
|
|
153
|
+
|
|
154
|
+
if not found then
|
|
155
|
+
raise exception
|
|
156
|
+
'OTA_DISTRIBUTION_CONTROL_MISSING: singleton row is required'
|
|
157
|
+
using errcode = '55000';
|
|
158
|
+
end if;
|
|
159
|
+
|
|
160
|
+
if distribution_blocked then
|
|
161
|
+
raise exception
|
|
162
|
+
'OTA_DISTRIBUTION_BLOCKED: % is not allowed while global OTA distribution is blocked',
|
|
163
|
+
p_operation
|
|
164
|
+
using
|
|
165
|
+
errcode = 'P0OTA',
|
|
166
|
+
hint = 'Deactivate updates or resume OTA distribution first.';
|
|
167
|
+
end if;
|
|
168
|
+
end;
|
|
169
|
+
$$;
|
|
170
|
+
|
|
171
|
+
revoke all on function public.assert_ota_distribution_mutation_allowed(text)
|
|
172
|
+
from public;
|
|
173
|
+
|
|
174
|
+
create or replace function public.guard_ota_update_distribution()
|
|
175
|
+
returns trigger
|
|
176
|
+
language plpgsql
|
|
177
|
+
security definer
|
|
178
|
+
set search_path = public, pg_temp
|
|
179
|
+
as $$
|
|
180
|
+
begin
|
|
181
|
+
-- Inactive inserts and all edits that do not activate a row stay available.
|
|
182
|
+
-- In particular, true -> false is deliberately allowed for incident repair.
|
|
183
|
+
if (tg_op = 'INSERT' and not new.is_active)
|
|
184
|
+
or (
|
|
185
|
+
tg_op = 'UPDATE'
|
|
186
|
+
and not (new.is_active and not old.is_active)
|
|
187
|
+
) then
|
|
188
|
+
return new;
|
|
189
|
+
end if;
|
|
190
|
+
|
|
191
|
+
perform public.assert_ota_distribution_mutation_allowed(
|
|
192
|
+
case
|
|
193
|
+
when tg_op = 'INSERT' then 'inserting an active OTA update'
|
|
194
|
+
else 'activating an OTA update'
|
|
195
|
+
end
|
|
196
|
+
);
|
|
197
|
+
return new;
|
|
198
|
+
end;
|
|
199
|
+
$$;
|
|
200
|
+
|
|
201
|
+
drop trigger if exists trg_ota_distribution_guard_updates
|
|
202
|
+
on public.ota_updates;
|
|
203
|
+
create trigger trg_ota_distribution_guard_updates
|
|
204
|
+
before insert or update on public.ota_updates
|
|
205
|
+
for each row
|
|
206
|
+
execute function public.guard_ota_update_distribution();
|
|
207
|
+
|
|
208
|
+
create or replace function public.guard_ota_channel_distribution()
|
|
209
|
+
returns trigger
|
|
210
|
+
language plpgsql
|
|
211
|
+
security definer
|
|
212
|
+
set search_path = public, pg_temp
|
|
213
|
+
as $$
|
|
214
|
+
declare
|
|
215
|
+
changes_distribution_state boolean;
|
|
216
|
+
begin
|
|
217
|
+
if tg_op = 'INSERT' then
|
|
218
|
+
-- Empty channel rows do not distribute an update.
|
|
219
|
+
changes_distribution_state :=
|
|
220
|
+
new.latest_update_id is not null
|
|
221
|
+
or new.active_update_id is not null;
|
|
222
|
+
else
|
|
223
|
+
changes_distribution_state :=
|
|
224
|
+
new.runtime_version is distinct from old.runtime_version
|
|
225
|
+
or new.channel is distinct from old.channel
|
|
226
|
+
or new.platform is distinct from old.platform
|
|
227
|
+
or new.latest_update_id is distinct from old.latest_update_id
|
|
228
|
+
or new.latest_created_at is distinct from old.latest_created_at
|
|
229
|
+
or new.latest_created_at_path is distinct from old.latest_created_at_path
|
|
230
|
+
or new.active_update_id is distinct from old.active_update_id
|
|
231
|
+
or new.active_changed_at is distinct from old.active_changed_at
|
|
232
|
+
or new.served_manifest_id is distinct from old.served_manifest_id
|
|
233
|
+
or new.served_manifest_changed_at
|
|
234
|
+
is distinct from old.served_manifest_changed_at;
|
|
235
|
+
end if;
|
|
236
|
+
|
|
237
|
+
if not changes_distribution_state then
|
|
238
|
+
return new;
|
|
239
|
+
end if;
|
|
240
|
+
|
|
241
|
+
-- Clearing every serving pointer only removes distribution and is the
|
|
242
|
+
-- channel-side part of deactivation. Clearing a rollback pointer while a
|
|
243
|
+
-- latest pointer remains would promote latest, so it is still guarded.
|
|
244
|
+
if new.latest_update_id is null and new.active_update_id is null then
|
|
245
|
+
return new;
|
|
246
|
+
end if;
|
|
247
|
+
|
|
248
|
+
perform public.assert_ota_distribution_mutation_allowed(
|
|
249
|
+
'changing OTA channel distribution state'
|
|
250
|
+
);
|
|
251
|
+
return new;
|
|
252
|
+
end;
|
|
253
|
+
$$;
|
|
254
|
+
|
|
255
|
+
drop trigger if exists trg_ota_distribution_guard_channels
|
|
256
|
+
on public.ota_update_channels;
|
|
257
|
+
create trigger trg_ota_distribution_guard_channels
|
|
258
|
+
before insert or update on public.ota_update_channels
|
|
259
|
+
for each row
|
|
260
|
+
execute function public.guard_ota_channel_distribution();
|
|
261
|
+
|
|
262
|
+
create or replace function public.set_ota_distribution_control(
|
|
263
|
+
p_blocked boolean,
|
|
264
|
+
p_reason text,
|
|
265
|
+
p_expected_version bigint,
|
|
266
|
+
p_changed_by jsonb
|
|
267
|
+
)
|
|
268
|
+
returns setof public.ota_distribution_control
|
|
269
|
+
language plpgsql
|
|
270
|
+
security definer
|
|
271
|
+
set search_path = public, pg_temp
|
|
272
|
+
as $$
|
|
273
|
+
declare
|
|
274
|
+
previous_row public.ota_distribution_control%rowtype;
|
|
275
|
+
updated_row public.ota_distribution_control%rowtype;
|
|
276
|
+
normalized_reason text;
|
|
277
|
+
begin
|
|
278
|
+
if p_expected_version is null or p_expected_version < 1 then
|
|
279
|
+
raise exception 'expectedVersion must be a positive integer'
|
|
280
|
+
using errcode = '22023';
|
|
281
|
+
end if;
|
|
282
|
+
|
|
283
|
+
if p_changed_by is null
|
|
284
|
+
or jsonb_typeof(p_changed_by) <> 'object'
|
|
285
|
+
or nullif(btrim(p_changed_by->>'type'), '') is null
|
|
286
|
+
or nullif(btrim(p_changed_by->>'id'), '') is null
|
|
287
|
+
or nullif(btrim(p_changed_by->>'label'), '') is null then
|
|
288
|
+
raise exception 'changedBy principal metadata is invalid'
|
|
289
|
+
using errcode = '22023';
|
|
290
|
+
end if;
|
|
291
|
+
|
|
292
|
+
normalized_reason := nullif(btrim(coalesce(p_reason, '')), '');
|
|
293
|
+
if p_blocked and normalized_reason is null then
|
|
294
|
+
raise exception 'reason is required when OTA distribution is blocked'
|
|
295
|
+
using errcode = '22023';
|
|
296
|
+
end if;
|
|
297
|
+
if p_blocked and (
|
|
298
|
+
char_length(normalized_reason) > 500
|
|
299
|
+
or normalized_reason ~ '[[:cntrl:]]'
|
|
300
|
+
) then
|
|
301
|
+
raise exception 'reason must contain at most 500 characters and no control characters'
|
|
302
|
+
using errcode = '22023';
|
|
303
|
+
end if;
|
|
304
|
+
if not p_blocked then
|
|
305
|
+
normalized_reason := null;
|
|
306
|
+
end if;
|
|
307
|
+
|
|
308
|
+
perform public.lock_ota_distribution_control();
|
|
309
|
+
|
|
310
|
+
select *
|
|
311
|
+
into previous_row
|
|
312
|
+
from public.ota_distribution_control
|
|
313
|
+
where singleton_id = 1
|
|
314
|
+
for update;
|
|
315
|
+
|
|
316
|
+
if not found then
|
|
317
|
+
raise exception 'OTA distribution control singleton is missing'
|
|
318
|
+
using errcode = '55000';
|
|
319
|
+
end if;
|
|
320
|
+
|
|
321
|
+
update public.ota_distribution_control
|
|
322
|
+
set blocked = p_blocked,
|
|
323
|
+
version = version + 1,
|
|
324
|
+
reason = normalized_reason,
|
|
325
|
+
changed_at = now(),
|
|
326
|
+
changed_by = p_changed_by
|
|
327
|
+
where singleton_id = 1
|
|
328
|
+
and version = p_expected_version
|
|
329
|
+
returning * into updated_row;
|
|
330
|
+
|
|
331
|
+
if not found then
|
|
332
|
+
raise exception 'OTA distribution control version conflict'
|
|
333
|
+
using errcode = '40001';
|
|
334
|
+
end if;
|
|
335
|
+
|
|
336
|
+
insert into public.ota_distribution_control_events (
|
|
337
|
+
previous_blocked,
|
|
338
|
+
blocked,
|
|
339
|
+
previous_version,
|
|
340
|
+
version,
|
|
341
|
+
reason,
|
|
342
|
+
changed_at,
|
|
343
|
+
changed_by
|
|
344
|
+
)
|
|
345
|
+
values (
|
|
346
|
+
previous_row.blocked,
|
|
347
|
+
updated_row.blocked,
|
|
348
|
+
previous_row.version,
|
|
349
|
+
updated_row.version,
|
|
350
|
+
updated_row.reason,
|
|
351
|
+
updated_row.changed_at,
|
|
352
|
+
updated_row.changed_by
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
return next updated_row;
|
|
356
|
+
end;
|
|
357
|
+
$$;
|
|
358
|
+
|
|
359
|
+
revoke all on function public.set_ota_distribution_control(
|
|
360
|
+
boolean,
|
|
361
|
+
text,
|
|
362
|
+
bigint,
|
|
363
|
+
jsonb
|
|
364
|
+
) from public;
|
|
365
|
+
|
|
366
|
+
do $$
|
|
367
|
+
begin
|
|
368
|
+
if exists (select 1 from pg_roles where rolname = 'service_role') then
|
|
369
|
+
grant execute on function public.set_ota_distribution_control(
|
|
370
|
+
boolean,
|
|
371
|
+
text,
|
|
372
|
+
bigint,
|
|
373
|
+
jsonb
|
|
374
|
+
) to service_role;
|
|
375
|
+
end if;
|
|
376
|
+
end;
|
|
377
|
+
$$;
|