← back to Ventura Corridor

db/migrations/018_magazine_engagement.sql

10 lines

-- Migration 018 — engagement columns on magazine_features.
-- The session-era code (and the new corpus-summary email) reads
-- mf.taps and mf.taps_breakdown; these need to exist alongside views.

ALTER TABLE magazine_features
  ADD COLUMN IF NOT EXISTS taps            INTEGER NOT NULL DEFAULT 0,
  ADD COLUMN IF NOT EXISTS taps_breakdown  JSONB NOT NULL DEFAULT '{}'::jsonb;

CREATE INDEX IF NOT EXISTS idx_magfeat_taps ON magazine_features (taps DESC) WHERE status='published';