zz_

app/worker/migrations/0005_repo_visibility_cache.sql

zzmq.dev@gmail.com/zz / app / worker / migrations / 0005_repo_visibility_cache.sql @ 867419d4 Download
Ladder Summary
  • file This migration adds a new `visibility` column to the `repos` table—a non‑null `TEXT` field limited to the values `'public'` or `'private'` and defaulting to `'public'`. The column serves as a D1‑side cache of each repository’s `meta.json` visibility policy so that listing endpoints can filter private repos without loading every repo’s orphan branch. No functions or classes are exported from this file.
 -- A D1-side cache of each repo's meta.json policy.visibility (source of
 -- truth stays zz-meta, same reasoning as repo_roles in migration 0004)
 -- -- needed so /explore and search can filter out private repos for
 -- viewers without access WITHOUT reading every repo's orphan branch on
 -- every listing request. Kept in sync by doCreateRepo/doSetVisibility.
 -- Defaults to 'public' to match ensureMeta's own default policy.
 ALTER TABLE repos ADD COLUMN visibility TEXT NOT NULL DEFAULT 'public' CHECK (visibility IN ('public', 'private'));