Skip to content

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

Fix wrong replacement of iops value when switching GP3 to IO2 (#34532)

Joshen Lim7710e54873cc
diff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts b/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts
index 162ee824607..bef3303bfca 100644
--- a/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts
+++ b/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts
@@ -104,8 +104,8 @@ export const calculateIOPSPrice = ({
0,
newProvisionedIOPS - DISK_LIMITS[DiskType.GP3].includedIops
)
- const oldPrice = oldChargeableIOPS * DISK_PRICING[oldStorageType]?.iops ?? 0
- const newPrice = newChargeableIOPS * DISK_PRICING[newStorageType]?.iops ?? 0
+ const oldPrice = oldChargeableIOPS * (DISK_PRICING[oldStorageType]?.iops ?? 0)
+ const newPrice = newChargeableIOPS * (DISK_PRICING[newStorageType]?.iops ?? 0)
return {
oldPrice: (oldPrice * (1 + numReplicas)).toFixed(2),
@@ -116,8 +116,8 @@ export const calculateIOPSPrice = ({
oldStorageType === 'gp3'
? (oldProvisionedIOPS - DISK_LIMITS[oldStorageType].includedIops) *
DISK_PRICING[oldStorageType].iops
- : oldProvisionedIOPS * DISK_PRICING[oldStorageType]?.iops ?? 0
- const newPrice = newProvisionedIOPS * DISK_PRICING[newStorageType]?.iops ?? 0
+ : oldProvisionedIOPS * (DISK_PRICING[oldStorageType]?.iops ?? 0)
+ const newPrice = newProvisionedIOPS * (DISK_PRICING[newStorageType]?.iops ?? 0)
return {
oldPrice: (oldPrice * (1 + numReplicas)).toFixed(2),
newPrice: (newPrice * (1 + numReplicas)).toFixed(2),
diff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx b/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
index 1de204394bd..c76965a4e80 100644
--- a/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
+++ b/apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx
@@ -242,7 +242,10 @@ export function DiskManagementForm() {
) {
willUpdateDiskConfiguration = true
- if (RESTRICTED_COMPUTE_FOR_THROUGHPUT_ON_GP3.includes(payload.computeSize)) {
+ if (
+ payload.storageType === 'gp3' &&
+ RESTRICTED_COMPUTE_FOR_THROUGHPUT_ON_GP3.includes(payload.computeSize)
+ ) {
payload.provisionedIOPS = IOPS_RANGE[DiskType.GP3].min
}