Skip to content

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

Squashed commit of the following:

Alaister Youngacf2ddb1c199
diff --git a/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx b/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx
index e84529e4ef2..45d21a02be4 100644
--- a/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx
+++ b/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx
@@ -324,8 +324,8 @@ export const USAGE_CATEGORIES: CategoryMeta[] = [
chartDescription: 'The data refreshes every 24 hours.',
links: [
{
- name: 'Realtime Quotas',
- url: 'https://supabase.com/docs/guides/realtime/quotas',
+ name: 'Realtime Rate Limits',
+ url: 'https://supabase.com/docs/guides/realtime/rate-limits',
},
],
},
@@ -341,8 +341,8 @@ export const USAGE_CATEGORIES: CategoryMeta[] = [
chartDescription: 'The data refreshes every 24 hours.',
links: [
{
- name: 'Realtime Quotas',
- url: 'https://supabase.com/docs/guides/realtime/quotas',
+ name: 'Realtime Rate Limits',
+ url: 'https://supabase.com/docs/guides/realtime/rate-limits',
},
],
},
diff --git a/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx b/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx
index 52a9a798e08..b95e49a637a 100644
--- a/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx
+++ b/studio/components/interfaces/BillingV2/Usage/UsageSection.tsx
@@ -148,7 +148,7 @@ const UsageSection = ({
barClass={clsx(
usageRatio >= 1
? usageBasedBilling
- ? 'bg-scale-1100'
+ ? 'bg-amber-900'
: 'bg-red-900'
: usageBasedBilling === false &&
usageRatio >= USAGE_APPROACHING_THRESHOLD
diff --git a/studio/data/edge-functions/edge-functions-update-mutation.tsx b/studio/data/edge-functions/edge-functions-update-mutation.tsx
new file mode 100644
index 00000000000..c7effaebacd
--- /dev/null
+++ b/studio/data/edge-functions/edge-functions-update-mutation.tsx
@@ -0,0 +1,51 @@
+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'
+import { patch } from 'lib/common/fetch'
+import { API_ADMIN_URL } from 'lib/constants'
+import { edgeFunctionsKeys } from './keys'
+
+export type EdgeFunctionsUpdateVariables = {
+ projectRef: string
+ slug: string
+ payload: {
+ name?: string
+ verifyJwt?: boolean
+ importMap?: boolean
+ }
+}
+
+export async function updateEdgeFunction({
+ projectRef,
+ slug,
+ payload,
+}: EdgeFunctionsUpdateVariables) {
+ if (!projectRef) throw new Error('projectRef is required')
+
+ const response = await patch(`${API_ADMIN_URL}/projects/${projectRef}/functions/${slug}`, payload)
+ if (response.error) throw response.error
+
+ return response
+}
+
+type EdgeFunctionsUpdateData = Awaited<ReturnType<typeof updateEdgeFunction>>
+
+export const useEdgeFunctionUpdateMutation = ({
+ onSuccess,
+ ...options
+}: Omit<
+ UseMutationOptions<EdgeFunctionsUpdateData, unknown, EdgeFunctionsUpdateVariables>,
+ 'mutationFn'
+> = {}) => {
+ const queryClient = useQueryClient()
+
+ return useMutation<EdgeFunctionsUpdateData, unknown, EdgeFunctionsUpdateVariables>(
+ (vars) => updateEdgeFunction(vars),
+ {
+ async onSuccess(data, variables, context) {
+ const { projectRef, slug } = variables
+ await queryClient.invalidateQueries(edgeFunctionsKeys.detail(projectRef, slug))
+ await onSuccess?.(data, variables, context)
+ },
+ ...options,
+ }
+ )
+}
diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.ts
index 483e5c6de69..38bef8423ea 100644
--- a/studio/stores/pgmeta/MetaStore.ts
+++ b/studio/stores/pgmeta/MetaStore.ts
@@ -407,7 +407,6 @@ export default class MetaStore implements IMetaStore {
try {
// Once pg-meta supports composite keys, we can remove this logic
const { isPrimaryKey, ...formattedPayload } = payload
-
const column: any = await this.columns.create(formattedPayload)
if (column.error) throw column.error