DatabaseReadOnlyAlert() — supabase Function Reference
Architecture documentation for the DatabaseReadOnlyAlert() function in DatabaseReadOnlyAlert.tsx from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/studio/components/interfaces/Settings/Database/DatabaseReadOnlyAlert.tsx lines 12–83
export const DatabaseReadOnlyAlert = () => {
const { ref: projectRef } = useParams()
const { data: organization } = useSelectedOrganizationQuery()
const [showConfirmationModal, setShowConfirmationModal] = useState(false)
const { data: resourceWarnings } = useResourceWarningsQuery({ ref: projectRef })
// [Joshen Cleanup] JFYI this can be cleaned up once BE changes are live which will only return the warnings based on the provided ref
// No longer need to filter by ref on the client side
const isReadOnlyMode =
(resourceWarnings ?? [])?.find((warning) => warning.project === projectRef)
?.is_readonly_mode_enabled ?? false
return (
<>
{isReadOnlyMode && (
<Alert_Shadcn_ variant="destructive">
<AlertTriangle />
<AlertTitle_Shadcn_>
Project is in read-only mode and database is no longer accepting write requests
</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
You have reached 95% of your project's disk space, and read-only mode has been enabled
to preserve your database's stability and prevent your project from exceeding its
current billing plan. To resolve this, you may:
<ul className="list-disc pl-6 mt-1">
<li>
Temporarily disable read-only mode to free up space and reduce your database size
</li>
{organization?.plan.id === 'free' ? (
<li>
<Link
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=databaseReadOnlyAlertUpgradePlan`}
>
<a className="text underline">Upgrade to the Pro Plan</a>
</Link>{' '}
to increase your database size limit to 8GB.
</li>
) : organization?.plan.id === 'pro' && organization?.usage_billing_enabled ? (
<li>
<Link
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=databaseReadOnlyAlertSpendCap`}
>
<a className="text-foreground underline">Disable your Spend Cap</a>
</Link>{' '}
to allow your project to auto-scale and expand beyond the 8GB database size limit
</li>
) : null}
</ul>
</AlertDescription_Shadcn_>
<div className="mt-4 flex items-center space-x-2">
<Button type="default" onClick={() => setShowConfirmationModal(true)}>
Disable read-only mode
</Button>
<Button asChild type="default" icon={<ExternalLink />}>
<a
href={`${DOCS_URL}/guides/platform/database-size#disabling-read-only-mode`}
target="_blank"
rel="noreferrer"
>
Learn more
</a>
</Button>
</div>
</Alert_Shadcn_>
)}
<ConfirmDisableReadOnlyModeModal
visible={showConfirmationModal}
onClose={() => setShowConfirmationModal(false)}
/>
</>
)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free