From a26b6524961d17ee69d9a68803177a0e27d83892 Mon Sep 17 00:00:00 2001 From: Sidney Swift <158200036+sidneyswift@users.noreply.github.com> Date: Fri, 10 Apr 2026 11:34:52 -0400 Subject: [PATCH] feat: create predictions table for neural engagement scoring Stores TRIBE v2 prediction results: engagement score, timeline, peak moments, weak spots, and regional brain activation data. Indexed by account_id and created_at for efficient queries. Made-with: Cursor --- .../20260410000000_create_predictions.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 supabase/migrations/20260410000000_create_predictions.sql diff --git a/supabase/migrations/20260410000000_create_predictions.sql b/supabase/migrations/20260410000000_create_predictions.sql new file mode 100644 index 0000000..4b92489 --- /dev/null +++ b/supabase/migrations/20260410000000_create_predictions.sql @@ -0,0 +1,23 @@ +-- Neural engagement predictions from TRIBE v2 model +create table if not exists public.predictions ( + id uuid primary key default gen_random_uuid(), + account_id uuid not null references public.accounts(id) on delete cascade, + file_url text not null, + modality text not null check (modality in ('video', 'audio', 'text')), + engagement_score numeric not null, + engagement_timeline jsonb not null, + peak_moments jsonb not null, + weak_spots jsonb not null, + regional_activation jsonb not null, + total_duration_seconds numeric not null, + elapsed_seconds numeric not null, + created_at timestamptz not null default now() +); + +create index if not exists idx_predictions_account_id + on public.predictions(account_id); + +create index if not exists idx_predictions_created_at + on public.predictions(created_at desc); + +alter table public.predictions enable row level security;