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.
-
Open your Supabase SQL Editor:
Open your Supabase project's SQL Editor -
Copy the entire contents of
complete-schema.sql(in this repo) -
Paste it into the SQL Editor and click "Run"
-
Verify it worked:
npx tsx check-database.ts
You should see all 10 tables marked with ✅
I've created a new working setup script:
npx tsx setup-database-fixed.tsThis will:
- Show you the SQL to run
- Provide a direct link to your Supabase SQL Editor
- Verify tables after you run the SQL
- ✅
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
Once tables are created, you can:
-
Validate everything works:
npm run validate
-
Start the oracle:
npm start
-
Track playlists:
npm run track-playlists
-
Query videos:
npm run query
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.