Home / Function/ generatePolicyUpdateSQL() — supabase Function Reference

generatePolicyUpdateSQL() — supabase Function Reference

Architecture documentation for the generatePolicyUpdateSQL() function in PolicyTableRow.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  e877ed13_f566_57c8_ea2d_a9f2a8e46834["generatePolicyUpdateSQL()"]
  e693f883_a62d_256c_8cc6_555f317f8e10["PolicyRow()"]
  e693f883_a62d_256c_8cc6_555f317f8e10 -->|calls| e877ed13_f566_57c8_ea2d_a9f2a8e46834
  style e877ed13_f566_57c8_ea2d_a9f2a8e46834 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRow.utils.ts lines 3–20

export const generatePolicyUpdateSQL = (policy: PostgresPolicy) => {
  let expression = ''
  if (policy.definition !== null && policy.definition !== undefined) {
    expression += `using (${policy.definition})${
      policy.check === null || policy.check === undefined ? ';' : ''
    }\n`
  }
  if (policy.check !== null && policy.check !== undefined) {
    expression += `with check (${policy.check});\n`
  }

  return `
alter policy "${policy.name}" 
on "${policy.schema}"."${policy.table}"
to ${policy.roles.join(', ')}
${expression}
`.trim()
}

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free