mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
10 lines
495 B
SQL
10 lines
495 B
SQL
ALTER TABLE public.vendors ADD COLUMN IF NOT EXISTS association_ids uuid[] NOT NULL DEFAULT ARRAY[]::uuid[];
|
|
|
|
-- Backfill: ensure existing single association_id is included in the array
|
|
UPDATE public.vendors
|
|
SET association_ids = ARRAY[association_id]
|
|
WHERE association_id IS NOT NULL
|
|
AND (association_ids IS NULL OR NOT (association_id = ANY(association_ids)));
|
|
|
|
-- Index for fast filtering
|
|
CREATE INDEX IF NOT EXISTS idx_vendors_association_ids ON public.vendors USING GIN (association_ids); |