← back to NationalPaperHangers

db/migrations/014_installer_social_videos.sql

20 lines

-- 014 — Social video handles for installer profiles.
-- Lets installers surface YouTube installation videos + Instagram reels +
-- TikTok content directly on their NPH profile. Three handles are stored:
--   youtube_handle   — channel handle (e.g. "@FromentalLondon" or "UCxxxx")
--   tiktok_handle    — username (without @)
--   featured_video_urls — jsonb array of curated direct video URLs for the
--                         "Watch the work" section. Format:
--                         [{"url":"https://...", "platform":"youtube|instagram|tiktok|vimeo", "title":"..."}]
--
-- instagram_handle already exists from the WIA scrape pipeline.

ALTER TABLE installers
  ADD COLUMN IF NOT EXISTS youtube_handle  text,
  ADD COLUMN IF NOT EXISTS tiktok_handle   text,
  ADD COLUMN IF NOT EXISTS featured_video_urls jsonb DEFAULT '[]'::jsonb NOT NULL;

CREATE INDEX IF NOT EXISTS idx_installers_has_video
  ON installers ((jsonb_array_length(featured_video_urls)))
  WHERE jsonb_array_length(featured_video_urls) > 0;