Skip to content

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

Add resize info in postgres upgrade modal (#30294)

Joshen Limfc352e152b71
diff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsx b/apps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsx
index 5ea06ca484a..d4995590490 100644
--- a/apps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsx
+++ b/apps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsx
@@ -55,7 +55,6 @@ import {
calculateIOPSPrice,
calculateThroughputPrice,
} from './DiskManagement.utils'
-import { getDiskStorageSchema } from './DiskManagementPanelSchema'
import { DiskManagementReviewAndSubmitDialog } from './DiskManagementReviewAndSubmitDialog'
import { BillingChangeBadge } from './ui/BillingChangeBadge'
import { DiskCountdownRadial } from './ui/DiskCountdownRadial'
@@ -169,7 +168,6 @@ export function DiskManagementPanelForm() {
totalSize: size_gb,
computeSize: undefined,
}
- const DiskStorageSchema = getDiskStorageSchema(size_gb)
const form = useForm<DiskStorageSchemaType>({
resolver: zodResolver(CreateDiskStorageSchema(defaultValues.totalSize)),
defaultValues,
diff --git a/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert/ProjectUpgradeAlert.tsx b/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert/ProjectUpgradeAlert.tsx
index ec6d0647d19..3a28c45b31f 100644
--- a/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert/ProjectUpgradeAlert.tsx
+++ b/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert/ProjectUpgradeAlert.tsx
@@ -39,6 +39,11 @@ import {
Tooltip_Shadcn_,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
+import { useDiskAttributesQuery } from 'data/config/disk-attributes-query'
+import { PLAN_DETAILS } from 'components/interfaces/DiskManagement/ui/DiskManagement.constants'
+import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
+import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
+import { Markdown } from 'components/interfaces/Markdown'
interface PostgresVersionDetails {
postgresEngine: string
@@ -62,10 +67,19 @@ const ProjectUpgradeAlert = () => {
const router = useRouter()
const { ref } = useParams()
const queryClient = useQueryClient()
+ const org = useSelectedOrganization()
const [showUpgradeModal, setShowUpgradeModal] = useState(false)
const projectUpgradeDisabled = useFlag('disableProjectUpgrade')
+ const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: org?.slug })
+ const planId = subscription?.plan.id ?? 'free'
+
+ const { data: diskAttributes } = useDiskAttributesQuery({ projectRef: ref })
+ const { includedDiskGB: includedDiskGBMeta } = PLAN_DETAILS[planId]
+ const includedDiskGB = includedDiskGBMeta[diskAttributes?.attributes.type ?? 'gp3']
+ const isDiskSizeUpdated = diskAttributes?.attributes.size_gb !== includedDiskGB
+
const { data } = useProjectUpgradeEligibilityQuery({ projectRef: ref })
const currentPgVersion = (data?.current_app_version ?? '').split('supabase-postgres-')[1]
const latestPgVersion = (data?.latest_app_version ?? '').split('supabase-postgres-')[1]
@@ -166,6 +180,14 @@ const ProjectUpgradeAlert = () => {
All services will be offline and you will not be able to downgrade back to
Postgres {currentPgVersion}.
</p>
+ {isDiskSizeUpdated && (
+ <Markdown
+ extLinks
+ className="text-foreground"
+ content={`Your current disk size of ${diskAttributes?.attributes.size_gb}GB will also be
+ [right-sized](https://supabase.com/docs/guides/platform/upgrading#disk-sizing) with the upgrade.`}
+ />
+ )}
{(data?.potential_breaking_changes ?? []).length > 0 && (
<Alert_Shadcn_ variant="destructive" title="Breaking changes">
<AlertCircle className="h-4 w-4" strokeWidth={2} />