Files
av-planner/supabase/migrations/20260909012000_device_templates_manufacturer_text.sql
T
aarbit b97777444a Wire the app to the shared Supabase catalog (public catalog read integration)
Moves port/cable/category/device-template data from per-diagram embedded
storage to the global public/private catalog backed by Supabase, per
organized-ideas.md's "live reference, not snapshot" decision.

- domain/types.ts, project.ts, compatibility.ts, bom.ts: lookup functions
  now take an explicit Catalog parameter instead of deriving data from
  Project — Project is reduced to just diagram-scoped fields.
- New CatalogRepository/SupabaseCatalogRepository (mirrors the
  DiagramRepository pattern) and catalogStore.ts, replacing the
  catalog-related actions that used to live in projectStore.
- device_templates gets a plain-text manufacturer column for now (the
  normalized manufacturer catalog from organized-ideas.md §3 is its own
  future pass, not blocking this one).
- domain/library.ts is no longer imported by the app — it's now only the
  source scripts/generate-seed.mjs reads to produce supabase/seed.sql.
- Swept every UI call site via tsc -b until clean; oxlint clean; 23/23
  pgTAP RLS tests still passing after a `supabase db reset`.
2026-09-07 23:42:00 -05:00

12 lines
826 B
SQL

-- device_templates currently has manufacturer_id (a FK into the normalized
-- `manufacturers` table), but nothing in the app populates or reads it yet —
-- organized-ideas.md §3 calls for manufacturer to eventually be a normalized,
-- submittable catalog like device categories, but wiring that up (browse-by-
-- manufacturer view, its own submission flow) is its own chunk of work.
-- For this pass (public catalog read integration), keep manufacturer as
-- plain free text on the template, matching the domain model's existing
-- `DeviceTemplate.manufacturer?: string` — the same shape it's always had
-- when templates lived embedded in each diagram. manufacturer_id is left in
-- place, unused, for the future normalization pass rather than dropped.
alter table public.device_templates add column manufacturer text;