-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase-terminal-update.sql
More file actions
19 lines (14 loc) · 966 Bytes
/
supabase-terminal-update.sql
File metadata and controls
19 lines (14 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Run in Supabase SQL editor to enable Semantic Narrative Matching & Terminal View.
-- 1. Add terminal-specific columns to narrative_tokens
ALTER TABLE public.narrative_tokens ADD COLUMN IF NOT EXISTS launched_here boolean DEFAULT false;
ALTER TABLE public.narrative_tokens ADD COLUMN IF NOT EXISTS match_score integer DEFAULT 0;
-- 2. Ensure indices exist for fast terminal categorization & sorting
CREATE INDEX IF NOT EXISTS narrative_tokens_launched_at_idx ON public.narrative_tokens (launched_at DESC);
CREATE INDEX IF NOT EXISTS narrative_tokens_match_score_idx ON public.narrative_tokens (match_score DESC);
-- 3. Add UNIQUE constraint to prevent duplicate tokens per tweet
-- This is critical for the pipeline's upsert logic.
ALTER TABLE public.narrative_tokens
DROP CONSTRAINT IF EXISTS narrative_tokens_tweet_ticker_unique;
ALTER TABLE public.narrative_tokens
ADD CONSTRAINT narrative_tokens_tweet_ticker_unique
UNIQUE (tweet_id, token_ticker);