← back to Ventura Corridor

db/migrations/007_ad_signals.sql

11 lines

-- 007_ad_signals.sql · the ad_signals JSONB column the code has been
-- writing to all along but that was never explicitly defined in a migration.
-- Adds it idempotently with a GIN index for the common boolean-key lookups.

ALTER TABLE business_enrichment
  ADD COLUMN IF NOT EXISTS ad_signals JSONB,
  ADD COLUMN IF NOT EXISTS signals_updated_at TIMESTAMPTZ;

CREATE INDEX IF NOT EXISTS idx_enrichment_ad_signals ON business_enrichment USING GIN (ad_signals);
CREATE INDEX IF NOT EXISTS idx_enrichment_signals_updated ON business_enrichment (signals_updated_at);