Skip to content

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

Add callout for migration (#39230)

Joshen Limc74dbc5f73af
diff --git a/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx b/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx
index 9b6057676a2..5cb2a24a83f 100644
--- a/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx
+++ b/apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx
@@ -88,7 +88,7 @@ export function DiskSizeField({
const mainDiskUsed = Math.round(((diskUtil?.metrics.fs_used_bytes ?? 0) / GB) * 100) / 100
return (
- <div className="grid @xl:grid-cols-12 gap-5">
+ <div id="disk-size" className="grid @xl:grid-cols-12 gap-5">
<div className="col-span-4">
<FormField_Shadcn_
name="totalSize"
diff --git a/apps/studio/components/interfaces/Storage/StorageMenu.tsx b/apps/studio/components/interfaces/Storage/StorageMenu.tsx
index 40dca82bbfe..a0c3243806e 100644
--- a/apps/studio/components/interfaces/Storage/StorageMenu.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageMenu.tsx
@@ -2,14 +2,16 @@ import Link from 'next/link'
import { useRouter } from 'next/router'
import { useState } from 'react'
-import { useParams } from 'common'
+import { useFlag, useParams } from 'common'
import { CreateBucketModal } from 'components/interfaces/Storage/CreateBucketModal'
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
+import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
import { useBucketsQuery } from 'data/storage/buckets-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { IS_PLATFORM } from 'lib/constants'
import { useStorageExplorerStateSnapshot } from 'state/storage-explorer'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, Menu } from 'ui'
+import { InfoTooltip } from 'ui-patterns/info-tooltip'
import {
InnerSideBarEmptyPanel,
InnerSideBarFilters,
@@ -24,6 +26,15 @@ export const StorageMenu = () => {
const { ref, bucketId } = useParams()
const { data: projectDetails } = useSelectedProjectQuery()
const snap = useStorageExplorerStateSnapshot()
+
+ const showMigrationCallout = useFlag('storageMigrationCallout')
+ const { data: config } = useProjectStorageConfigQuery(
+ { projectRef: ref },
+ { enabled: showMigrationCallout }
+ )
+ const isListV2UpgradeAvailable =
+ !!config && !config.capabilities.list_v2 && config.external.upstreamTarget === 'main'
+
const isBranch = projectDetails?.parent_project_ref !== undefined
const [searchText, setSearchText] = useState<string>('')
@@ -159,7 +170,12 @@ export const StorageMenu = () => {
{IS_PLATFORM && (
<Link href={`/project/${ref}/storage/settings`}>
<Menu.Item rounded active={page === 'settings'}>
- <p className="truncate">Settings</p>
+ <div className="flex items-center gap-x-2">
+ <p className="truncate">Settings</p>
+ {isListV2UpgradeAvailable && (
+ <InfoTooltip side="right">Upgrade available</InfoTooltip>
+ )}
+ </div>
</Menu.Item>
</Link>
)}
diff --git a/apps/studio/components/interfaces/Storage/StorageSettings/StorageListV2MigrationCallout.tsx b/apps/studio/components/interfaces/Storage/StorageSettings/StorageListV2MigrationCallout.tsx
new file mode 100644
index 00000000000..4f02d92836b
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/StorageSettings/StorageListV2MigrationCallout.tsx
@@ -0,0 +1,143 @@
+import dayjs from 'dayjs'
+import { toast } from 'sonner'
+
+import { useParams } from 'common'
+import { InlineLink } from 'components/ui/InlineLink'
+import { useProjectStorageConfigUpdateUpdateMutation } from 'data/config/project-storage-config-update-mutation'
+import { useState } from 'react'
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogSection,
+ DialogSectionSeparator,
+ DialogTitle,
+ DialogTrigger,
+} from 'ui'
+import { Admonition, TimestampInfo } from 'ui-patterns'
+
+// [Joshen] Will be decided by Storage team, temp setting to 15th December 2025 UTC (3 months buffer)
+const MIGRATION_DEADLINE = '2025-12-15T00:00:00'
+
+export const StorageListV2MigrationCallout = () => {
+ const deadline = dayjs(MIGRATION_DEADLINE).utc(true)
+ const currentDate = dayjs.utc()
+ const remainingMonths = Math.ceil(deadline.diff(currentDate, 'months', true))
+
+ return (
+ <Admonition
+ type={remainingMonths <= 1 ? 'warning' : 'note'}
+ title="A new version of Storage is available for your project"
+ >
+ <p className="!leading-normal prose max-w-full text-sm !mb-0">
+ Get access to the List-V2 endpoint for improved performance and the ability to enable
+ Analytics buckets to your storage system
+ </p>
+ {remainingMonths <= 1 && (
+ <p className="!leading-normal prose max-w-full text-sm">
+ Your project's Storage will be automatically upgraded by{' '}
+ <TimestampInfo
+ displayAs="utc"
+ utcTimestamp={MIGRATION_DEADLINE}
+ className="text-sm text-foreground"
+ labelFormat="DD MMM YYYY HH:mm (UTC)"
+ />{' '}
+ if the upgrade is not completed by then.
+ </p>
+ )}
+ <div className="flex items-center gap-x-2 mt-3">
+ <StorageListV2MigrationDialog />
+ </div>
+ </Admonition>
+ )
+}
+
+export const StorageListV2MigratingCallout = () => {
+ return (
+ <Admonition type="note" title="Project's storage is currently upgrading">
+ <p className="!leading-normal prose max-w-full text-sm !mb-0">
+ This notice will be closed once the upgrade has been completed - hang tight!
+ </p>
+ </Admonition>
+ )
+}
+
+const StorageListV2MigrationDialog = () => {
+ const { ref } = useParams()
+
+ const [open, setOpen] = useState(false)
+
+ const { mutate: updateStorageConfig, isLoading: isUpdating } =
+ useProjectStorageConfigUpdateUpdateMutation({
+ onSuccess: () => {
+ toast.success(`Project's storage will be upgraded shortly!`)
+ setOpen(false)
+ },
+ })
+
+ const onConfirmUpgrade = () => {
+ if (!ref) return console.error('Project ref is required')
+ updateStorageConfig({ projectRef: ref, external: { upstreamTarget: 'canary' } })
+ }
+
+ return (
+ <Dialog open={open} onOpenChange={setOpen}>
+ <DialogTrigger asChild>
+ <Button type="primary">Upgrade Storage</Button>
+ </DialogTrigger>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Upgrade your project's Storage</DialogTitle>
+ <DialogDescription>
+ Get access to Analytics buckets and an improved list method
+ </DialogDescription>
+ </DialogHeader>
+
+ <DialogSectionSeparator />
+
+ <Admonition
+ type="warning"
+ className="mb-0 rounded-none border-x-0 border-t-0"
+ title="Migration required to optimise the database schema for upgrade"
+ description="We recommend running the update during periods of lower activity, although minimal to no disruption is expected."
+ />
+
+ <DialogSection className="flex flex-col gap-y-2">
+ <p className="text-sm">
+ Depending on the number of objects in your Storage, the migration can take up to 24
+ hours to finish.
+ </p>
+
+ <p className="text-sm">
+ The upgrade will increase your disk size to about 15 - 25% and IOPS will be used to
+ create new efficient indexes as well as denormalising tables.
+ </p>
+
+ <p className="text-sm">
+ Ensure that your database instance has not{' '}
+ <InlineLink href={`/project/${ref}/settings/compute-and-disk#disk-size`}>
+ scaled disk
+ </InlineLink>{' '}
+ within the last 6h and you have at least 60%{' '}
+ <InlineLink href={`/project/${ref}/settings/infrastructure#infrastructure-activity`}>
+ CPU capacity
+ </InlineLink>{' '}
+ before proceeding.
+ </p>
+ </DialogSection>
+
+ <DialogFooter>
+ <Button type="default" disabled={isUpdating} onClick={() => setOpen(false)}>
+ Cancel
+ </Button>
+ <Button type="primary" loading={isUpdating} onClick={() => onConfirmUpgrade()}>
+ Upgrade now
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx b/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx
index 9e0f0836b57..431f40e6522 100644
--- a/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx
@@ -6,7 +6,7 @@ import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import * as z from 'zod'
-import { useParams } from 'common'
+import { useFlag, useParams } from 'common'
import { ScaffoldSection } from 'components/layouts/Scaffold'
import AlertError from 'components/ui/AlertError'
import { InlineLink } from 'components/ui/InlineLink'
@@ -41,6 +41,10 @@ import {
TooltipTrigger,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
+import {
+ StorageListV2MigratingCallout,
+ StorageListV2MigrationCallout,
+} from './StorageListV2MigrationCallout'
import {
STORAGE_FILE_SIZE_LIMIT_MAX_BYTES_CAPPED,
STORAGE_FILE_SIZE_LIMIT_MAX_BYTES_FREE_PLAN,
@@ -59,6 +63,8 @@ interface StorageSettingsState {
export const StorageSettings = () => {
const { ref: projectRef } = useParams()
+ const showMigrationCallout = useFlag('storageMigrationCallout')
+
const { can: canReadStorageSettings, isLoading: isLoadingPermissions } = useAsyncCheckPermissions(
PermissionAction.STORAGE_ADMIN_READ,
'*'
@@ -75,6 +81,10 @@ export const StorageSettings = () => {
isSuccess,
isError,
} = useProjectStorageConfigQuery({ projectRef })
+ const isListV2UpgradeAvailable =
+ !!config && !config.capabilities.list_v2 && config.external.upstreamTarget === 'main'
+ const isListV2Upgrading =
+ !!config && !config.capabilities.list_v2 && config.external.upstreamTarget === 'canary'
const { data: organization } = useSelectedOrganizationQuery()
const isFreeTier = organization?.plan.id === 'free'
@@ -223,6 +233,12 @@ export const StorageSettings = () => {
subject="Failed to retrieve project's storage configuration"
/>
)}
+ {isSuccess && showMigrationCallout && (
+ <>
+ {isListV2UpgradeAvailable && <StorageListV2MigrationCallout />}
+ {isListV2Upgrading && <StorageListV2MigratingCallout />}
+ </>
+ )}
{isSuccess && (
<form id={formId} className="" onSubmit={form.handleSubmit(onSubmit)}>
<Card>
@@ -448,5 +464,3 @@ export const StorageSettings = () => {
</ScaffoldSection>
)
}
-
-export default StorageSettings