Home / Function/ DeleteFunction() — supabase Function Reference

DeleteFunction() — supabase Function Reference

Architecture documentation for the DeleteFunction() function in DeleteFunction.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/Database/Functions/DeleteFunction.tsx lines 17–59

export const DeleteFunction = ({
  func,
  visible,
  setVisible,
  onDelete,
  isLoading,
}: DeleteFunctionProps) => {
  const { data: project } = useSelectedProjectQuery()
  const { name, schema } = func ?? {}

  async function handleDelete() {
    if (!func) return console.error('Function is required')
    if (!project) return console.error('Project is required')

    onDelete({
      func,
      projectRef: project.ref,
      connectionString: project.connectionString,
    })
  }

  return (
    <TextConfirmModal
      variant={'warning'}
      visible={visible}
      onCancel={() => setVisible(null)}
      onConfirm={handleDelete}
      title="Delete this function"
      loading={isLoading}
      confirmLabel={`Delete function ${name}`}
      confirmPlaceholder="Type in name of function"
      confirmString={name ?? 'Unknown'}
      text={
        <>
          <span>This will delete the function</span>{' '}
          <span className="text-bold text-foreground">{name}</span> <span>from the schema</span>{' '}
          <span className="text-bold text-foreground">{schema}</span>
        </>
      }
      alert={{ title: 'You cannot recover this function once deleted.' }}
    />
  )
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free