← back to Animals

migrations/014_business_products_carried.sql

28 lines

-- Project: Animals — pet_store inventory hint.
--
-- Adds a `products_carried text[]` column to businesses so /clinic/:id pages
-- for pet_store rows can show a chips list of brands/items the store stocks.
-- We don't actually scrape inventory from each store — it's a generic seed
-- list of the obvious common items so the page isn't empty for stores we
-- haven't enriched yet. Stores with real, enriched inventory will get their
-- list overwritten by the enrichment job; the seed is just a default.

BEGIN;

ALTER TABLE businesses
  ADD COLUMN IF NOT EXISTS products_carried TEXT[];

-- Seed common inventory for pet_store rows that don't already have one.
-- Idempotent — only fills NULLs, won't clobber enriched data.
UPDATE businesses
   SET products_carried = ARRAY[
         'Chewy',
         'Blue Buffalo',
         'Kong',
         'Petco house brand'
       ]
 WHERE category = 'pet_store'
   AND products_carried IS NULL;

COMMIT;