Files
K-Dog (Kevin) 1da25a7e72 chore(hipaa): self-serve PITR (#51342)
There is no reason why HIPAA customers cannot self-serve PITR add-on.
Instead of telling customers to reach out to support, let them
self-serve it.

- Docs also wrongfully stated the need for Small compute add-on.
- Ability to self-serve PITR
- Only 28-day PITR available
- Price is now also correct and displays $0 (pending backend change)

When enabled (marked as HIPAA compliant):
<img width="1128" height="216" alt="Screenshot 2026-10-06 at 1 53 01 PM"
src="https://github.com/user-attachments/assets/d83982e7-c71b-4236-ab29-67f85fc40f39"
/>

When not enabled (marked as HIPAA compliant):
<img width="1132" height="255" alt="Screenshot 2026-10-06 at 1 53 55 PM"
src="https://github.com/user-attachments/assets/f182813b-2163-4905-8cdf-9c69983ec1b9"
/>

<img width="772" height="542" alt="Screenshot 2026-10-06 at 1 56 08 PM"
src="https://github.com/user-attachments/assets/2cd59439-74b9-49d6-90d1-47c8d1722c9f"
/>
2026-10-06 15:11:55 +02:00

140 lines
3.1 KiB
TypeScript

export interface IPv4DisabledReasonOptions {
isAws: boolean
isProjectActive: boolean
projectUpdateDisabled: boolean
canUpdateIPv4: boolean
ipv4Enabled: boolean
isHighAvailability: boolean
}
export const getIPv4DisabledReason = ({
isAws,
isProjectActive,
projectUpdateDisabled,
canUpdateIPv4,
ipv4Enabled,
isHighAvailability,
}: IPv4DisabledReasonOptions) => {
if (isHighAvailability) {
return 'Dedicated IPv4 address is unavailable on High Availability projects'
}
if (!isAws) {
return 'Dedicated IPv4 address is only available for AWS projects'
}
if (!isProjectActive) {
return 'Project must be active to update IPv4'
}
if (projectUpdateDisabled) {
return 'Project updates are currently disabled'
}
if (!canUpdateIPv4 && !ipv4Enabled) {
return 'You can only add IPv4 when your project network configuration is set to IPv6'
}
return undefined
}
export interface PitrDisabledReasonOptions {
isProjectActive: boolean
projectUpdateDisabled: boolean
hasHipaaAddon: boolean
sufficientPgVersion: boolean
isOrioleDbInAws: boolean
isHighAvailability: boolean
}
export const getPitrDisabledReason = ({
isProjectActive,
projectUpdateDisabled,
hasHipaaAddon,
sufficientPgVersion,
isOrioleDbInAws,
isHighAvailability,
}: PitrDisabledReasonOptions) => {
if (isHighAvailability) {
return 'Point in time recovery is unavailable on High Availability projects'
}
if (!isProjectActive) {
return 'Project must be active to update PITR'
}
if (projectUpdateDisabled) {
return 'Project updates are currently disabled'
}
if (hasHipaaAddon) {
return 'PITR cannot be changed with HIPAA enabled'
}
if (!sufficientPgVersion) {
return 'Your project is too old to enable PITR'
}
if (isOrioleDbInAws) {
return 'Point in time recovery is not supported with OrioleDB'
}
return undefined
}
export interface CustomDomainDisabledReasonOptions {
isProjectActive: boolean
projectUpdateDisabled: boolean
isHighAvailability: boolean
}
export const getCustomDomainDisabledReason = ({
isProjectActive,
projectUpdateDisabled,
isHighAvailability,
}: CustomDomainDisabledReasonOptions) => {
if (isHighAvailability) {
return 'Custom domain is unavailable on High Availability projects'
}
if (!isProjectActive) {
return 'Project must be active to update custom domain'
}
if (projectUpdateDisabled) {
return 'Project updates are currently disabled'
}
return undefined
}
export type PitrAlertState =
| 'hipaa'
| 'hipaa-non-compliant'
| 'legacy-project'
| 'orioledb'
| undefined
export const getPitrAlertState = ({
hasHipaaAddon,
hasHipaaCompliantPitr = true,
sufficientPgVersion,
isOrioleDbInAws,
}: Pick<PitrDisabledReasonOptions, 'hasHipaaAddon' | 'sufficientPgVersion' | 'isOrioleDbInAws'> & {
hasHipaaCompliantPitr?: boolean
}): PitrAlertState => {
if (hasHipaaAddon) {
return hasHipaaCompliantPitr ? 'hipaa' : 'hipaa-non-compliant'
}
if (!sufficientPgVersion) {
return 'legacy-project'
}
if (isOrioleDbInAws) {
return 'orioledb'
}
return undefined
}