Skip to content

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

Fix

Joshen Lim6c773ba47cf8
diff --git a/studio/components/interfaces/BillingV2/Subscription/AddOns/AddOns.tsx b/studio/components/interfaces/BillingV2/Subscription/AddOns/AddOns.tsx
index 98cab652a62..f294bf38861 100644
--- a/studio/components/interfaces/BillingV2/Subscription/AddOns/AddOns.tsx
+++ b/studio/components/interfaces/BillingV2/Subscription/AddOns/AddOns.tsx
@@ -2,7 +2,15 @@ import { useParams, useTheme } from 'common'
import dayjs from 'dayjs'
import Link from 'next/link'
import { useMemo } from 'react'
-import { Alert, Button, IconChevronRight, IconExternalLink } from 'ui'
+import {
+ Alert,
+ AlertDescription_Shadcn_,
+ AlertTitle_Shadcn_,
+ Alert_Shadcn_,
+ Button,
+ IconChevronRight,
+ IconExternalLink,
+} from 'ui'
import ProjectUpdateDisabledTooltip from 'components/interfaces/Organization/BillingSettings/ProjectUpdateDisabledTooltip'
import {
@@ -20,8 +28,9 @@ import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
import { useFlag } from 'hooks'
import { getCloudProviderArchitecture } from 'lib/cloudprovider-utils'
import { BASE_PATH } from 'lib/constants'
+import { getSemanticVersion } from 'lib/helpers'
import { useSubscriptionPageStateSnapshot } from 'state/subscription-page'
-import { getAddons, getSemanticVersion } from '../Subscription.utils'
+import { getAddons } from '../Subscription.utils'
const AddOns = () => {
const { isDarkMode } = useTheme()
@@ -35,7 +44,6 @@ const AddOns = () => {
// Only projects of version greater than supabase-postgrest-14.1.0.44 can use PITR
const sufficientPgVersion = getSemanticVersion(selectedProject?.dbVersion ?? '') >= 141044
- console.log({ sufficientPgVersion })
// [Joshen] We could possibly look into reducing the interval to be more "realtime"
// I tried setting the interval to 1m but no data was returned, may need to experiment
@@ -313,19 +321,39 @@ const AddOns = () => {
? `Point in time recovery of ${pitr.variant.meta?.backup_duration_days} days is enabled`
: 'Point in time recovery is not enabled'}
</p>
- <ProjectUpdateDisabledTooltip
- projectUpdateDisabled={projectUpdateDisabled}
- projectNotActive={!isProjectActive}
- >
- <Button
- type="default"
- className="mt-2 pointer-events-auto"
- onClick={() => snap.setPanelKey('pitr')}
- disabled={!isProjectActive || projectUpdateDisabled}
+ {!sufficientPgVersion ? (
+ <Alert_Shadcn_ className="mt-2">
+ <AlertTitle_Shadcn_>
+ Your project is too old to be able to enable PITR for
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ <p className="text-sm leading-normal mb-2">
+ Reach out to us via support if you're interested
+ </p>
+ <Link
+ href={`/support/new?ref=${projectRef}&category=sales&subject=Project%20too%20old%20old%20for%20PITR`}
+ >
+ <a>
+ <Button type="default">Contact support</Button>
+ </a>
+ </Link>
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+ ) : (
+ <ProjectUpdateDisabledTooltip
+ projectUpdateDisabled={projectUpdateDisabled}
+ projectNotActive={!isProjectActive}
>
- Change point in time recovery
- </Button>
- </ProjectUpdateDisabledTooltip>
+ <Button
+ type="default"
+ className="mt-2 pointer-events-auto"
+ onClick={() => snap.setPanelKey('pitr')}
+ disabled={!isProjectActive || projectUpdateDisabled || !sufficientPgVersion}
+ >
+ Change point in time recovery
+ </Button>
+ </ProjectUpdateDisabledTooltip>
+ )}
</div>
</div>
diff --git a/studio/components/interfaces/BillingV2/Subscription/Subscription.tsx b/studio/components/interfaces/BillingV2/Subscription/Subscription.tsx
index 2ba895d23d9..2edafb2f14c 100644
--- a/studio/components/interfaces/BillingV2/Subscription/Subscription.tsx
+++ b/studio/components/interfaces/BillingV2/Subscription/Subscription.tsx
@@ -10,8 +10,6 @@ import InformationBox from 'components/ui/InformationBox'
import { Button, IconExternalLink, IconInfo } from 'ui'
import Link from 'next/link'
-// [Joshen] This can be deprecated I think - no longer used
-
export interface SubscriptionProps {}
const Subscription = ({}: SubscriptionProps) => {
diff --git a/studio/components/interfaces/BillingV2/Subscription/Subscription.utils.ts b/studio/components/interfaces/BillingV2/Subscription/Subscription.utils.ts
index 614f1beaa27..1b288cee149 100644
--- a/studio/components/interfaces/BillingV2/Subscription/Subscription.utils.ts
+++ b/studio/components/interfaces/BillingV2/Subscription/Subscription.utils.ts
@@ -18,17 +18,3 @@ export const subscriptionHasHipaaAddon = (
subscription.addons.some((addon) => addon.supabase_prod_id === 'addon_security_hipaa')
)
}
-
-export const getSemanticVersion = (version: string) => {
- if (!version) return 0
-
- // e.g supabase-postgres-14.1.0.88
- // There's 4 segments instead so we can't use the semver package
- const segments = version.split('supabase-postgres-')
- const semver = segments[segments.length - 1]
-
- // e.g supabase-postgres-14.1.0.99-vault-rc1
- const formattedSemver = semver.split('-')[0]
-
- return Number(formattedSemver.split('.').join(''))
-}
diff --git a/studio/components/interfaces/Settings/Addons/Addons.tsx b/studio/components/interfaces/Settings/Addons/Addons.tsx
index 93b414df8f6..9c7db762f7c 100644
--- a/studio/components/interfaces/Settings/Addons/Addons.tsx
+++ b/studio/components/interfaces/Settings/Addons/Addons.tsx
@@ -23,6 +23,7 @@ import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
import { useFlag, useProjectByRef } from 'hooks'
import { getCloudProviderArchitecture } from 'lib/cloudprovider-utils'
import { BASE_PATH } from 'lib/constants'
+import { getSemanticVersion } from 'lib/helpers'
import { SUBSCRIPTION_PANEL_KEYS, useSubscriptionPageStateSnapshot } from 'state/subscription-page'
import {
Alert,
@@ -53,8 +54,7 @@ const Addons = () => {
const cpuArchitecture = getCloudProviderArchitecture(selectedProject?.cloud_provider)
// Only projects of version greater than supabase-postgrest-14.1.0.44 can use PITR
- // const sufficientPgVersion = getSemanticVersion(selectedProject?.dbVersion ?? '') >= 141044
- const sufficientPgVersion = false
+ const sufficientPgVersion = getSemanticVersion(selectedProject?.dbVersion ?? '') >= 141044
// [Joshen] We could possibly look into reducing the interval to be more "realtime"
// I tried setting the interval to 1m but no data was returned, may need to experiment
diff --git a/studio/lib/helpers.ts b/studio/lib/helpers.ts
index 843c2b4727d..fd74478d6bb 100644
--- a/studio/lib/helpers.ts
+++ b/studio/lib/helpers.ts
@@ -280,3 +280,17 @@ export const removeCommentsFromSql = (sql: string) => {
return cleanedSql
}
+
+export const getSemanticVersion = (version: string) => {
+ if (!version) return 0
+
+ // e.g supabase-postgres-14.1.0.88
+ // There's 4 segments instead so we can't use the semver package
+ const segments = version.split('supabase-postgres-')
+ const semver = segments[segments.length - 1]
+
+ // e.g supabase-postgres-14.1.0.99-vault-rc1
+ const formattedSemver = semver.split('-')[0]
+
+ return Number(formattedSemver.split('.').join(''))
+}