Skip to content

Commit 2195581

Browse files
authored
Remove the queue_ prefix from queues API endpoints (supabase#30695)
remove the queue_ prefix from queues API endpoints
1 parent 3415459 commit 2195581

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

apps/studio/data/database-queues/database-queues-toggle-postgrest-mutation.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const EXPOSE_QUEUES_TO_POSTGREST_SQL = minify(/* SQL */ `
1919
create schema if not exists ${QUEUES_SCHEMA};
2020
grant usage on schema ${QUEUES_SCHEMA} to postgres, anon, authenticated, service_role;
2121
22-
create or replace function ${QUEUES_SCHEMA}.queue_pop(
22+
create or replace function ${QUEUES_SCHEMA}.pop(
2323
queue_name text
2424
)
2525
returns setof pgmq.message_record
@@ -35,10 +35,10 @@ begin
3535
end;
3636
$$;
3737
38-
comment on function ${QUEUES_SCHEMA}.queue_pop(queue_name text) is 'Retrieves and locks the next message from the specified queue.';
38+
comment on function ${QUEUES_SCHEMA}.pop(queue_name text) is 'Retrieves and locks the next message from the specified queue.';
3939
4040
41-
create or replace function ${QUEUES_SCHEMA}.queue_send(
41+
create or replace function ${QUEUES_SCHEMA}.send(
4242
queue_name text,
4343
message jsonb,
4444
sleep_seconds integer default 0 -- renamed from 'delay'
@@ -58,10 +58,10 @@ begin
5858
end;
5959
$$;
6060
61-
comment on function ${QUEUES_SCHEMA}.queue_send(queue_name text, message jsonb, sleep_seconds integer) is 'Sends a message to the specified queue, optionally delaying its availability by a number of seconds.';
61+
comment on function ${QUEUES_SCHEMA}.send(queue_name text, message jsonb, sleep_seconds integer) is 'Sends a message to the specified queue, optionally delaying its availability by a number of seconds.';
6262
6363
64-
create or replace function ${QUEUES_SCHEMA}.queue_send_batch(
64+
create or replace function ${QUEUES_SCHEMA}.send_batch(
6565
queue_name text,
6666
messages jsonb[],
6767
sleep_seconds integer default 0 -- renamed from 'delay'
@@ -81,10 +81,10 @@ begin
8181
end;
8282
$$;
8383
84-
comment on function ${QUEUES_SCHEMA}.queue_send_batch(queue_name text, messages jsonb[], sleep_seconds integer) is 'Sends a batch of messages to the specified queue, optionally delaying their availability by a number of seconds.';
84+
comment on function ${QUEUES_SCHEMA}.send_batch(queue_name text, messages jsonb[], sleep_seconds integer) is 'Sends a batch of messages to the specified queue, optionally delaying their availability by a number of seconds.';
8585
8686
87-
create or replace function ${QUEUES_SCHEMA}.queue_archive(
87+
create or replace function ${QUEUES_SCHEMA}.archive(
8888
queue_name text,
8989
message_id bigint
9090
)
@@ -101,10 +101,10 @@ begin
101101
end;
102102
$$;
103103
104-
comment on function ${QUEUES_SCHEMA}.queue_archive(queue_name text, message_id bigint) is 'Archives a message by moving it from the queue to a permanent archive.';
104+
comment on function ${QUEUES_SCHEMA}.archive(queue_name text, message_id bigint) is 'Archives a message by moving it from the queue to a permanent archive.';
105105
106106
107-
create or replace function ${QUEUES_SCHEMA}.queue_archive(
107+
create or replace function ${QUEUES_SCHEMA}.archive(
108108
queue_name text,
109109
message_id bigint
110110
)
@@ -121,10 +121,10 @@ begin
121121
end;
122122
$$;
123123
124-
comment on function ${QUEUES_SCHEMA}.queue_archive(queue_name text, message_id bigint) is 'Archives a message by moving it from the queue to a permanent archive.';
124+
comment on function ${QUEUES_SCHEMA}.archive(queue_name text, message_id bigint) is 'Archives a message by moving it from the queue to a permanent archive.';
125125
126126
127-
create or replace function ${QUEUES_SCHEMA}.queue_delete(
127+
create or replace function ${QUEUES_SCHEMA}.delete(
128128
queue_name text,
129129
message_id bigint
130130
)
@@ -141,9 +141,9 @@ begin
141141
end;
142142
$$;
143143
144-
comment on function ${QUEUES_SCHEMA}.queue_delete(queue_name text, message_id bigint) is 'Permanently deletes a message from the specified queue.';
144+
comment on function ${QUEUES_SCHEMA}.delete(queue_name text, message_id bigint) is 'Permanently deletes a message from the specified queue.';
145145
146-
create or replace function ${QUEUES_SCHEMA}.queue_read(
146+
create or replace function ${QUEUES_SCHEMA}.read(
147147
queue_name text,
148148
sleep_seconds integer,
149149
n integer
@@ -163,25 +163,25 @@ begin
163163
end;
164164
$$;
165165
166-
comment on function ${QUEUES_SCHEMA}.queue_read(queue_name text, sleep_seconds integer, n integer) is 'Reads up to "n" messages from the specified queue with an optional "sleep_seconds" (visibility timeout).';
166+
comment on function ${QUEUES_SCHEMA}.read(queue_name text, sleep_seconds integer, n integer) is 'Reads up to "n" messages from the specified queue with an optional "sleep_seconds" (visibility timeout).';
167167
168168
-- Grant execute permissions on wrapper functions to roles
169-
grant execute on function ${QUEUES_SCHEMA}.queue_pop(text) to postgres, service_role, anon, authenticated;
169+
grant execute on function ${QUEUES_SCHEMA}.pop(text) to postgres, service_role, anon, authenticated;
170170
grant execute on function pgmq.pop(text) to postgres, service_role, anon, authenticated;
171171
172-
grant execute on function ${QUEUES_SCHEMA}.queue_send(text, jsonb, integer) to postgres, service_role, anon, authenticated;
172+
grant execute on function ${QUEUES_SCHEMA}.send(text, jsonb, integer) to postgres, service_role, anon, authenticated;
173173
grant execute on function pgmq.send(text, jsonb, integer) to postgres, service_role, anon, authenticated;
174174
175-
grant execute on function ${QUEUES_SCHEMA}.queue_send_batch(text, jsonb[], integer) to postgres, service_role, anon, authenticated;
175+
grant execute on function ${QUEUES_SCHEMA}.send_batch(text, jsonb[], integer) to postgres, service_role, anon, authenticated;
176176
grant execute on function pgmq.send_batch(text, jsonb[], integer) to postgres, service_role, anon, authenticated;
177177
178-
grant execute on function ${QUEUES_SCHEMA}.queue_archive(text, bigint) to postgres, service_role, anon, authenticated;
178+
grant execute on function ${QUEUES_SCHEMA}.archive(text, bigint) to postgres, service_role, anon, authenticated;
179179
grant execute on function pgmq.archive(text, bigint) to postgres, service_role, anon, authenticated;
180180
181-
grant execute on function ${QUEUES_SCHEMA}.queue_delete(text, bigint) to postgres, service_role, anon, authenticated;
181+
grant execute on function ${QUEUES_SCHEMA}.delete(text, bigint) to postgres, service_role, anon, authenticated;
182182
grant execute on function pgmq.delete(text, bigint) to postgres, service_role, anon, authenticated;
183183
184-
grant execute on function ${QUEUES_SCHEMA}.queue_read(text, integer, integer) to postgres, service_role, anon, authenticated;
184+
grant execute on function ${QUEUES_SCHEMA}.read(text, integer, integer) to postgres, service_role, anon, authenticated;
185185
grant execute on function pgmq.read(text, integer, integer) to postgres, service_role, anon, authenticated;
186186
187187
-- For the service role, we want full access
@@ -196,12 +196,12 @@ grant usage on schema pgmq to postgres, anon, authenticated, service_role;
196196

197197
const HIDE_QUEUES_FROM_POSTGREST_SQL = minify(/* SQL */ `
198198
drop function if exists
199-
${QUEUES_SCHEMA}.queue_pop(queue_name text),
200-
${QUEUES_SCHEMA}.queue_send(queue_name text, message jsonb, sleep_seconds integer),
201-
${QUEUES_SCHEMA}.queue_send_batch(queue_name text, message jsonb[], sleep_seconds integer),
202-
${QUEUES_SCHEMA}.queue_archive(queue_name text, message_id bigint),
203-
${QUEUES_SCHEMA}.queue_delete(queue_name text, message_id bigint),
204-
${QUEUES_SCHEMA}.queue_read(queue_name text, sleep integer, n integer)
199+
${QUEUES_SCHEMA}.pop(queue_name text),
200+
${QUEUES_SCHEMA}.send(queue_name text, message jsonb, sleep_seconds integer),
201+
${QUEUES_SCHEMA}.send_batch(queue_name text, message jsonb[], sleep_seconds integer),
202+
${QUEUES_SCHEMA}.archive(queue_name text, message_id bigint),
203+
${QUEUES_SCHEMA}.delete(queue_name text, message_id bigint),
204+
${QUEUES_SCHEMA}.read(queue_name text, sleep integer, n integer)
205205
;
206206
207207
-- Revoke execute permissions on inner pgmq functions to roles (inverse of enabling)

0 commit comments

Comments
 (0)