@@ -19,14 +19,20 @@ import {
1919 AlertTitle_Shadcn_ ,
2020 Alert_Shadcn_ ,
2121 Badge ,
22- Button ,
2322 Input ,
2423 Tooltip ,
2524 TooltipContent ,
2625 TooltipTrigger ,
2726} from 'ui'
2827import { ProjectUpgradeAlert } from '../General/Infrastructure/ProjectUpgradeAlert'
2928import InstanceConfiguration from './InfrastructureConfiguration/InstanceConfiguration'
29+ import {
30+ DatabaseExtensionsWarning ,
31+ ObjectsToBeDroppedWarning ,
32+ ReadReplicasWarning ,
33+ UnsupportedExtensionsWarning ,
34+ UserDefinedObjectsInInternalSchemasWarning ,
35+ } from './UpgradeWarnings'
3036
3137const InfrastructureInfo = ( ) => {
3238 const { ref } = useParams ( )
@@ -73,6 +79,12 @@ const InfrastructureInfo = () => {
7379 const isInactive = project ?. status === 'INACTIVE'
7480 const hasReadReplicas = ( databases ?? [ ] ) . length > 1
7581
82+ // @ts -ignore [Bobbie] to be removed after 2025-06-30 prod deploy
83+ const hasExtensionDependentObjects = ( data ?. extension_dependent_objects ?? [ ] ) . length > 0
84+ const hasObjectsToBeDropped = ( data ?. objects_to_be_dropped ?? [ ] ) . length > 0
85+ const hasUnsupportedExtensions = ( data ?. unsupported_extensions || [ ] ) . length > 0
86+ const hasObjectsInternalSchema = ( data ?. user_defined_objects_in_internal_schemas || [ ] ) . length > 0
87+
7688 return (
7789 < >
7890 < ScaffoldDivider />
@@ -181,149 +193,38 @@ const InfrastructureInfo = () => {
181193 </ >
182194 ) }
183195
184- { data ?. eligible && ! hasReadReplicas && < ProjectUpgradeAlert /> }
185- { data . eligible && hasReadReplicas && (
186- < Alert_Shadcn_ >
187- < AlertTitle_Shadcn_ >
188- A new version of Postgres is available for your project
189- </ AlertTitle_Shadcn_ >
190- < AlertDescription_Shadcn_ >
191- You will need to remove all read replicas prior to upgrading your Postgres
192- version to the latest available ({ latestPgVersion } ).
193- </ AlertDescription_Shadcn_ >
194- </ Alert_Shadcn_ >
195- ) }
196- { /* TODO(bobbie): once extension_dependent_objects is removed on the backend, remove this block and the ts-ignores below */ }
197- { ! data ?. eligible && ( data ?. extension_dependent_objects || [ ] ) . length > 0 && (
198- < Alert_Shadcn_
199- variant = "warning"
200- title = "A new version of Postgres is available for your project"
201- >
202- < AlertTitle_Shadcn_ >
203- A new version of Postgres is available
204- </ AlertTitle_Shadcn_ >
205- < AlertDescription_Shadcn_ className = "flex flex-col gap-3" >
206- < div >
207- < p className = "mb-1" >
208- You'll need to remove the following extensions before upgrading:
209- </ p >
210-
211- < ul className = "pl-4" >
212- { ( data ?. extension_dependent_objects || [ ] ) . map ( ( obj ) => (
213- < li className = "list-disc" key = { obj } >
214- { obj }
215- </ li >
216- ) ) }
217- </ ul >
218- </ div >
219- < p >
220- { projectUpgradeEligibilityData ?. potential_breaking_changes ?. includes (
221- 'pg17_upgrade_unsupported_extensions'
222- )
223- ? 'These extensions are not supported in newer versions of Supabase Postgres. If you are not using them, it is safe to remove them.'
224- : 'Check the docs for which ones might need to be removed.' }
225- </ p >
226- < div >
227- < Button size = "tiny" type = "default" asChild >
228- < a
229- href = "https://supabase.com/docs/guides/platform/upgrading#extensions"
230- target = "_blank"
231- rel = "noreferrer"
232- >
233- View docs
234- </ a >
235- </ Button >
236- </ div >
237- </ AlertDescription_Shadcn_ >
238- </ Alert_Shadcn_ >
239- ) }
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 >
196+ { data . eligible ? (
197+ hasReadReplicas ? (
198+ < ReadReplicasWarning latestPgVersion = { latestPgVersion } />
199+ ) : (
200+ < ProjectUpgradeAlert />
201+ )
202+ ) : null }
297203
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- ) }
204+ { ! data . eligible ? (
205+ hasExtensionDependentObjects ? (
206+ < DatabaseExtensionsWarning
207+ // @ts -ignore
208+ extensions = { data . extension_dependent_objects ?? [ ] }
209+ potentialBreakingChanges = {
210+ // @ts -ignore
211+ projectUpgradeEligibilityData ?. potential_breaking_changes
212+ }
213+ />
214+ ) : hasObjectsToBeDropped ? (
215+ < ObjectsToBeDroppedWarning
216+ objectsToBeDropped = { data . objects_to_be_dropped }
217+ />
218+ ) : hasUnsupportedExtensions ? (
219+ < UnsupportedExtensionsWarning
220+ unsupportedExtensions = { data . unsupported_extensions }
221+ />
222+ ) : hasObjectsInternalSchema ? (
223+ < UserDefinedObjectsInInternalSchemasWarning
224+ objects = { data . user_defined_objects_in_internal_schemas }
225+ />
226+ ) : null
227+ ) : null }
327228 </ >
328229 ) }
329230 </ >
0 commit comments