Docs🚨 EMERGENCY DATABASE SETUP - COVENANT WITNESS REGISTRY

🚨 EMERGENCY DATABASE SETUP - COVENANT WITNESS REGISTRY

🚨 EMERGENCY DATABASE SETUP - COVENANT WITNESS REGISTRY

CRITICAL SITUATION

  • • Abraham's Covenant Launch: October 19, 2025 (51 days remaining)
  • • Witness Target: 100 Founding Witnesses
  • • Current Status: Database schema not deployed - BLOCKING witness registration
  • • Action Required: Manual Supabase database setup
  • IMMEDIATE DEPLOYMENT STEPS

    1. Access Supabase Dashboard

    `` URL: https://app.supabase.com/project/ctlygyrkibupejllgglr/sql/new Login: Your Supabase account `

    2. Execute Database Schema

  • Open the Supabase SQL Editor
  • Copy the entire contents of /scripts/supabase-table-setup.sql
  • Paste into the SQL editor
  • Click RUN to execute
  • 3. Verify Deployment

    After running the SQL script, you should see:
  • • ✅ 3 tables created: covenant_witnesses, witness_notifications, covenant_events
  • • ✅ 7 indexes created for performance
  • • ✅ 2 helper functions: get_witness_count(), is_witness()
  • • ✅ Row Level Security policies enabled
  • • ✅ Success message displayed
  • 4. Test Deployment

    Run these test queries in the SQL editor:
    `sql -- Test witness count function SELECT * FROM get_witness_count(); -- Verify tables exist SELECT COUNT(*) as witness_count FROM covenant_witnesses; SELECT COUNT(*) as notification_count FROM witness_notifications; SELECT COUNT(*) as event_count FROM covenant_events; ` Expected results: ` get_witness_count: total_witnesses=0, target_witnesses=100, critical_status='CRITICAL' witness_count: 0 notification_count: 0 event_count: 0 `

    TABLES CREATED

    covenant_witnesses

  • • Purpose: Core witness registry
  • • Key Fields: address (primary), witness_number (serial), email, ens_name
  • • Constraints: Valid Ethereum address format, unique witness numbers
  • witness_notifications

  • • Purpose: Email notification queue and tracking
  • • Key Fields: witness_address (FK), email, template, status
  • • Templates: welcome, milestone, emergency, daily_auction
  • covenant_events

  • • Purpose: Milestone and event logging
  • • Key Fields: event_type, event_data (JSONB), created_at
  • POST-DEPLOYMENT VERIFICATION

    Once database is deployed, run the system validation:
    `bash NEXT_PUBLIC_SUPABASE_URL=https://ctlygyrkibupejllgglr.supabase.co \ SUPABASE_SERVICE_KEY=your_service_key \ npx tsx scripts/witness-registry-validation.ts ` Expected output should show:
  • • ✅ Database: covenant_witnesses table operational
  • • ✅ Database: witness_notifications table operational
  • • ✅ Database: covenant_events table operational
  • • ✅ Database: Database functions operational
  • TROUBLESHOOTING

    If tables fail to create:

  • Check for existing tables with same names
  • Verify service_role permissions
  • Try creating tables individually
  • If functions fail:

    `sql -- Manually create get_witness_count function CREATE OR REPLACE FUNCTION get_witness_count() RETURNS TABLE (total_witnesses INT, target_witnesses INT, percent_complete INT) AS $$ BEGIN RETURN QUERY SELECT COUNT(*)::INT as total, 100 as target, ROUND((COUNT()::FLOAT / 100) 100)::INT as percent FROM covenant_witnesses WHERE status = 'active'; END; $$ LANGUAGE plpgsql; `

    If RLS policies fail:

    `sql -- Ensure service role has full access CREATE POLICY "Service role full access" ON covenant_witnesses FOR ALL USING (auth.role() = 'service_role'); `

    AFTER SUCCESSFUL DEPLOYMENT

  • Re-run validation script to confirm all systems are operational
  • Start development server to test API endpoints
  • Test witness registration flow with Web3 interface
  • Begin founding witness recruitment once all tests pass
  • CRITICAL SUCCESS METRICS

    After database deployment, system should achieve:
  • • ✅ All API endpoints responding (200 status)
  • • ✅ Witness registration flow operational
  • • ✅ Email notifications functional
  • • ✅ Smart contract integration ready
  • • ✅ Frontend pages accessible
  • TARGET: Complete database deployment within 30 minutes to maintain October 19 launch timeline.

    FILES INVOLVED

  • • scripts/supabase-table-setup.sql - Main database schema
  • • scripts/witness-registry-validation.ts - System validation
  • • src/app/api/covenant/witnesses/route.ts - API endpoints
  • • src/lib/covenant/email-notifications.ts - Email system
  • • src/components/covenant/WitnessRegistryInterface.tsx` - Frontend UI
  • AFTER DEPLOYMENT: Run full system validation to confirm covenant witness registry is operational.