Home / Function/ getRelationshipsForTable() — supabase Function Reference

getRelationshipsForTable() — supabase Function Reference

Architecture documentation for the getRelationshipsForTable() function in Policies.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  ecdff9bf_ef72_96b6_1353_50970d8742c5["getRelationshipsForTable()"]
  f79e5138_9a55_c32e_e916_b04b77d8deb4["findPathToAuthUsers()"]
  f79e5138_9a55_c32e_e916_b04b77d8deb4 -->|calls| ecdff9bf_ef72_96b6_1353_50970d8742c5
  style ecdff9bf_ef72_96b6_1353_50970d8742c5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Auth/Policies/Policies.utils.ts lines 187–208

const getRelationshipsForTable = ({
  schema,
  table,
  fkConstraints,
}: {
  schema: string
  table: string
  fkConstraints: ForeignKeyConstraint[]
}): Relationship[] => {
  return fkConstraints
    .filter((fk) => fk.source_schema === schema && fk.source_table === table)
    .flatMap((fk) =>
      fk.source_columns.map((sourceCol, i) => ({
        source_schema: fk.source_schema,
        source_table_name: fk.source_table,
        source_column_name: sourceCol,
        target_table_schema: fk.target_schema,
        target_table_name: fk.target_table,
        target_column_name: fk.target_columns[i],
      }))
    )
}

Subdomains

Frequently Asked Questions

What does getRelationshipsForTable() do?
getRelationshipsForTable() is a function in the supabase codebase.
What calls getRelationshipsForTable()?
getRelationshipsForTable() is called by 1 function(s): findPathToAuthUsers.

Analyze Your Own Codebase

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

Try Supermodel Free