Skip to content

Commit 226d05f

Browse files
authored
fix: warning message on upgrade guards (supabase#36646)
* fix: warning message on upgrade guards When users are blocked from an upgrade because they have objects that need to be dropped, the message in the warning is incorrect. It asks users to "drop these extensions". But they're not extensions, they're user-defined tables, foreign keys, etc. This will cause confusion. Here we use a different messaging when users need to drop their objects. * chore: prettier
1 parent 84b8695 commit 226d05f

File tree

3 files changed

+98
-6
lines changed

3 files changed

+98
-6
lines changed

apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ const InfrastructureInfo = () => {
193193
</AlertDescription_Shadcn_>
194194
</Alert_Shadcn_>
195195
)}
196+
{/* TODO(bobbie): once extension_dependent_objects is removed on the backend, remove this block and the ts-ignores below */}
196197
{!data?.eligible && (data?.extension_dependent_objects || []).length > 0 && (
197198
<Alert_Shadcn_
198199
variant="warning"
@@ -222,7 +223,6 @@ const InfrastructureInfo = () => {
222223
? 'These extensions are not supported in newer versions of Supabase Postgres. If you are not using them, it is safe to remove them.'
223224
: 'Check the docs for which ones might need to be removed.'}
224225
</p>
225-
226226
<div>
227227
<Button size="tiny" type="default" asChild>
228228
<a
@@ -237,6 +237,93 @@ const InfrastructureInfo = () => {
237237
</AlertDescription_Shadcn_>
238238
</Alert_Shadcn_>
239239
)}
240+
{!data?.eligible &&
241+
// @ts-ignore
242+
(data?.objects_to_be_dropped || []).length > 0 && (
243+
<Alert_Shadcn_
244+
variant="warning"
245+
title="A new version of Postgres is available for your project"
246+
>
247+
<AlertTitle_Shadcn_>
248+
A new version of Postgres is available
249+
</AlertTitle_Shadcn_>
250+
<AlertDescription_Shadcn_ className="flex flex-col gap-3">
251+
<div>
252+
<p className="mb-1">
253+
You'll need to remove the following objects before upgrading:
254+
</p>
255+
256+
<ul className="pl-4">
257+
{
258+
// @ts-ignore
259+
(data?.objects_to_be_dropped || []).map((obj: string) => (
260+
<li className="list-disc" key={obj}>
261+
{obj}
262+
</li>
263+
))
264+
}
265+
</ul>
266+
</div>
267+
<p>Check the docs for which objects need to be removed.</p>
268+
<div>
269+
<Button size="tiny" type="default" asChild>
270+
<a
271+
href="https://supabase.com/docs/guides/platform/upgrading#extensions"
272+
target="_blank"
273+
rel="noreferrer"
274+
>
275+
View docs
276+
</a>
277+
</Button>
278+
</div>
279+
</AlertDescription_Shadcn_>
280+
</Alert_Shadcn_>
281+
)}
282+
{!data?.eligible &&
283+
// @ts-ignore
284+
(data?.unsupported_extensions || []).length > 0 && (
285+
<Alert_Shadcn_
286+
variant="warning"
287+
title="A new version of Postgres is available for your project"
288+
>
289+
<AlertTitle_Shadcn_>
290+
A new version of Postgres is available
291+
</AlertTitle_Shadcn_>
292+
<AlertDescription_Shadcn_ className="flex flex-col gap-3">
293+
<div>
294+
<p className="mb-1">
295+
You'll need to remove the following extensions before upgrading:
296+
</p>
297+
298+
<ul className="pl-4">
299+
{
300+
// @ts-ignore
301+
(data?.unsupported_extensions || []).map((obj: string) => (
302+
<li className="list-disc" key={obj}>
303+
{obj}
304+
</li>
305+
))
306+
}
307+
</ul>
308+
</div>
309+
<p>
310+
These extensions are not supported in newer versions of Supabase
311+
Postgres. If you are not using them, it is safe to remove them.
312+
</p>
313+
<div>
314+
<Button size="tiny" type="default" asChild>
315+
<a
316+
href="https://supabase.com/docs/guides/platform/upgrading#extensions"
317+
target="_blank"
318+
rel="noreferrer"
319+
>
320+
View docs
321+
</a>
322+
</Button>
323+
</div>
324+
</AlertDescription_Shadcn_>
325+
</Alert_Shadcn_>
326+
)}
240327
</>
241328
)}
242329
</>

packages/ai-commands/src/docs.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ export async function clippy(
6363

6464
const [{ embedding }] = embeddingResponse.data
6565

66-
const { error: matchError, data: pageSections } = await supabaseClient
66+
const { error: matchError, data: pageSections } = (await supabaseClient
6767
.rpc('match_page_sections_v2', {
6868
embedding,
6969
match_threshold: 0.78,
7070
min_content_length: 50,
7171
})
7272
.neq('rag_ignore', true)
7373
.select('content,page!inner(path),rag_ignore')
74-
.limit(10) as { error: any; data: PageSection[] | null }
74+
.limit(10)) as { error: any; data: PageSection[] | null }
7575

7676
if (matchError || !pageSections) {
7777
throw new ApplicationError('Failed to match page sections', matchError)
@@ -93,10 +93,10 @@ export async function clippy(
9393
}
9494

9595
const pagePath = pageSection.page.path
96-
96+
9797
// Include source reference with each section
9898
contextText += `[Source ${sourceIndex}: ${pagePath}]\n${content.trim()}\n---\n`
99-
99+
100100
// Track sources for later reference
101101
if (!sourcesMap.has(pagePath)) {
102102
sourcesMap.set(pagePath, content)

packages/ui-patterns/src/CommandMenu/prepackaged/ai/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ interface FinalizeWithSourcesAction {
4949
index: number
5050
}
5151

52-
type MessageAction = NewMessageAction | UpdateMessageAction | AppendContentAction | ResetAction | FinalizeWithSourcesAction
52+
type MessageAction =
53+
| NewMessageAction
54+
| UpdateMessageAction
55+
| AppendContentAction
56+
| ResetAction
57+
| FinalizeWithSourcesAction
5358

5459
export { MessageRole, MessageStatus }
5560
export type { Message, MessageAction, SourceLink }

0 commit comments

Comments
 (0)