Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 1.94 KB

File metadata and controls

83 lines (59 loc) · 1.94 KB

⚠️ CRITICAL: Database Setup Required

The Problem

The setup-database.ts script is broken and doesn't work. It tries to use supabase.rpc('exec_sql') which doesn't exist in Supabase, so NO TABLES WERE CREATED.

Quick Fix (5 minutes)

Option 1: Run SQL in Supabase Dashboard (RECOMMENDED)

  1. Open your Supabase SQL Editor:

    Open your Supabase project's SQL Editor
    
  2. Copy the entire contents of complete-schema.sql (in this repo)

  3. Paste it into the SQL Editor and click "Run"

  4. Verify it worked:

    npx tsx check-database.ts

    You should see all 10 tables marked with ✅

Option 2: Use the Fixed Setup Script

I've created a new working setup script:

npx tsx setup-database-fixed.ts

This will:

  • Show you the SQL to run
  • Provide a direct link to your Supabase SQL Editor
  • Verify tables after you run the SQL

What Tables Will Be Created

  • videos - Track video statistics
  • channel_stats - Track channel statistics
  • minting_events - Log all token mints
  • thumbnails - Store thumbnail metadata
  • oracle_state - Track oracle state/quota
  • playlists - Track playlist statistics
  • playlist_images - Store generated playlist images
  • nft_mints - Track NFT mints
  • holders - Track NFT holder data
  • airdrops - Track airdrop campaigns

After Setup

Once tables are created, you can:

  1. Validate everything works:

    npm run validate
  2. Start the oracle:

    npm start
  3. Track playlists:

    npm run track-playlists
  4. Query videos:

    npm run query

Why This Happened

The original setup-database.ts used an approach that requires:

  • A custom Supabase RPC function called exec_sql
  • Or the Service Role key (not the anon key)

Neither were set up, so the SQL never executed even though the script claimed success.