Home / Function/ updateChecksumIfNeeded() — supabase Function Reference

updateChecksumIfNeeded() — supabase Function Reference

Architecture documentation for the updateChecksumIfNeeded() function in Troubleshooting.script.mjs from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  9fb0512e_b8b0_fd5b_0755_8ccbb0346831["updateChecksumIfNeeded()"]
  9518e40b_fa13_8f55_5b39_98d14611b96a["syncTroubleshootingEntries()"]
  9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| 9fb0512e_b8b0_fd5b_0755_8ccbb0346831
  1a9da56d_2644_9c17_0fab_6733599f480b["supabaseAdmin()"]
  9fb0512e_b8b0_fd5b_0755_8ccbb0346831 -->|calls| 1a9da56d_2644_9c17_0fab_6733599f480b
  73f04d43_e114_e11d_0fbe_d1fb61a6a717["calculateChecksum()"]
  9fb0512e_b8b0_fd5b_0755_8ccbb0346831 -->|calls| 73f04d43_e114_e11d_0fbe_d1fb61a6a717
  style 9fb0512e_b8b0_fd5b_0755_8ccbb0346831 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Troubleshooting.script.mjs lines 226–257

async function updateChecksumIfNeeded(entry) {
  const { data, error } = await supabaseAdmin()
    .from('troubleshooting_entries')
    .select('checksum')
    .eq('id', entry.data.database_id)
    .single()
  if (error) {
    throw error
  }

  const newChecksum = calculateChecksum(entry.content)
  if (data.checksum !== newChecksum) {
    console.log(`[INFO] Content changed for ${entry.data.title}. Updating checksum.`)

    const now = new Date().toISOString()
    const { error } = await supabaseAdmin()
      .from('troubleshooting_entries')
      .update({
        checksum: newChecksum,
        date_updated: now,
      })
      .eq('id', entry.data.database_id)

    if (error) {
      throw error
    }

    return true
  }

  return false
}

Subdomains

Frequently Asked Questions

What does updateChecksumIfNeeded() do?
updateChecksumIfNeeded() is a function in the supabase codebase.
What does updateChecksumIfNeeded() call?
updateChecksumIfNeeded() calls 2 function(s): calculateChecksum, supabaseAdmin.
What calls updateChecksumIfNeeded()?
updateChecksumIfNeeded() is called by 1 function(s): syncTroubleshootingEntries.

Analyze Your Own Codebase

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

Try Supermodel Free