Database Schema — ChurchWiseAI Web
All tables owned or primarily used by churchwiseai-web — voice agent, chatbot, subscriptions, care, ShareWiseAI, SermonWise, and operational tables
All tables owned or primarily used by churchwiseai-web — voice agent, chatbot, subscriptions, care, ShareWiseAI, SermonWise, and operational tables
All tables owned by sermon-illustrations/ and SermonWise — illustration content, scripture analysis, theological lenses, lectionary, word studies, and user subscriptions
All tables owned or primarily used by pewsearch/web — church listings, denominations, directory enrichment, and geographic data
Index of all Supabase table documentation — shared production database used by all three active codebases. See sub-docs for per-codebase schema detail.
Decision
Diagnose slow Supabase queries with EXPLAIN ANALYZE, identify missing indexes, fix pagination issues (missing .range()), and resolve Supabase advisory warnings
Context
Exact DDL, column-level changes, migration sequence, and code-path updates for the shared-core + per-vertical-tenant-tables architecture chosen on 2026-04-21. This is the implementation companion to the decision doc.
Documents the 158 remaining WARNINGs in validate_product_knowledge() as batch-provisioning artifacts, not real data quality issues. Includes the 3 content corrections applied during this audit.
Supabase SQL queries for product metrics — chatbot conversation counts, voice call volume, ITW page views, premium church counts, and cross-property revenue summary
Refresh stale Supabase cached aggregates (church stats, denomination counts) when query results are outdated — dir_illustrations is a regular view and never needs refreshing
Regenerate OpenAI text-embedding-3-small vectors for unified_rag_content rows — identify rows with null embeddings, run the embedding script, and verify RAG search improves
Apply a schema change to the shared production Supabase database — write migration SQL, verify with dry run, get founder approval for destructive ops, execute, and save to pewsearch/migrations/
Single shared Supabase PostgreSQL instance (dev + prod) — client setup, auth configuration, RLS policies, storage buckets, and safety rules for the shared production database
Index of technical ops runbooks — DB migrations, performance, embedding regeneration, error triage, security incidents, Stripe webhook debugging, view refresh, cost audit, backup verification, and running tests
Confirm Supabase automated backups are running — verify backup timestamps, run record count checks on critical tables (unified_rag_content, churches, premium_churches)