import { useState } from 'react' import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogSection, DialogSectionSeparator, DialogTitle, DialogTrigger, } from 'ui' import { Admonition } from 'ui-patterns' import { INTERNAL_SCHEMAS, useIsProtectedSchema } from '@/hooks/useProtectedSchemas' export const ProtectedSchemaDialog = ({ onClose }: { onClose: () => void }) => { return ( <> Schemas managed by Supabase

The following schemas are managed by Supabase and are currently protected from write access through the dashboard.

{INTERNAL_SCHEMAS.map((schema) => ( {schema} ))}

These schemas are critical to the functionality of your Supabase project and hence we highly recommend not altering them.

You can, however, still interact with those schemas through the SQL Editor although we advise you only do so if you know what you are doing.

) } export const ProtectedSchemaWarning = ({ size = 'md', schema, entity, }: { size?: 'sm' | 'md' schema: string entity: string }) => { const [showModal, setShowModal] = useState(false) const { isSchemaLocked, reason, fdwType } = useIsProtectedSchema({ schema }) if (!isSchemaLocked) return null const showLearnMoreDialog = reason !== 'fdw' || (fdwType !== 'iceberg' && fdwType !== 's3_vectors') return ( The {schema} schema is used by Supabase to connect to analytics buckets and is read-only through the dashboard.

) : reason === 'fdw' && fdwType === 's3_vectors' ? (

The {schema} schema is used by Supabase to connect to vector buckets and is read-only through the dashboard.

) : (

The {schema} schema is managed by Supabase and is read-only through the dashboard.

) } actions={ showLearnMoreDialog && ( setShowModal(false)} /> ) } /> ) }