Skip to content

Commit 922780f

Browse files
awaseemivasilov
andauthored
Fix/enable queue rest management pqmq versions (supabase#40023)
* added queues and keys to fetch version * updated to support postREST queue management * updated to use existing hook * removed unused keys * - added semvar lib - updated logic to use semvar lib * The conditional read was added in 1.5.0. --------- Co-authored-by: Ivan Vasilov <[email protected]>
1 parent 592f03f commit 922780f

File tree

6 files changed

+529
-175
lines changed

6 files changed

+529
-175
lines changed

apps/studio/components/interfaces/Integrations/Queues/QueuesSettings.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
QUEUES_SCHEMA,
2020
useDatabaseQueueToggleExposeMutation,
2121
} from 'data/database-queues/database-queues-toggle-postgrest-mutation'
22+
import { useDatabaseQueuesVersionQuery } from 'data/database-queues/database-queues-version-query'
2223
import { useTableUpdateMutation } from 'data/tables/table-update-mutation'
2324
import { useTablesQuery } from 'data/tables/tables-query'
2425
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
@@ -78,6 +79,11 @@ export const QueuesSettings = () => {
7879
})
7980
const schemas = config?.db_schema.replace(/ /g, '').split(',') ?? []
8081

82+
const { data: pgmqVersion } = useDatabaseQueuesVersionQuery({
83+
projectRef: project?.ref,
84+
connectionString: project?.connectionString,
85+
})
86+
8187
const { mutateAsync: updateTable } = useTableUpdateMutation()
8288

8389
const { mutate: updatePostgrestConfig } = useProjectPostgrestConfigUpdateMutation({
@@ -161,12 +167,16 @@ export const QueuesSettings = () => {
161167
`Failed to toggle queue exposure via PostgREST: Unable to retrieve PostgREST configuration (${configError.message})`
162168
)
163169
}
170+
if (!pgmqVersion) {
171+
return toast.error('Unable to retrieve PGMQ version. Please try again later.')
172+
}
164173

165174
setIsToggling(true)
166175
toggleExposeQueuePostgrest({
167176
projectRef: project.ref,
168177
connectionString: project.connectionString,
169178
enable: values.enable,
179+
pgmqVersion,
170180
})
171181
}
172182

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const PGMQ_EXTENSION_NAME = 'pgmq' as const

0 commit comments

Comments
 (0)